• Create Account

# h4tt3n

Member Since 02 Apr 2008
Offline Last Active Jul 13 2016 11:54 AM

### In Topic: How does Runge-Kutta 4 work in games

06 June 2016 - 02:13 PM

What about manual capping? What if I ensured that the damping never exceeds more force than needed to get object exactly at it's rest position? And for spring to ensure that the force never exceeds the force needed to push it to the other side of the rest length point at the same distance? Is this kind of good idea?

I wrote an article about improving spring stability with simple math. It might be of help to you. My next article presenting even better springs is on its way.

http://www.gamedev.net/page/resources/_/technical/math-and-physics/towards-a-simpler-stiffer-and-more-stable-spring-r3227

### In Topic: How does Runge-Kutta 4 work in games

06 June 2016 - 06:37 AM

Don't use RK4 in games. It is not symplectic, which means that it doesn't conserve enery. Also, I believe that like other higher order integators, it behaves poory with velocity dependent movement. Use symplectic Euler /semi-implicit Euler (at smaller timestep) instead. If you need the high accuracy, instead use David Whysong's excellent integrators that have 4th, 6th, and 8th order accuracy.

### In Topic: Destructiblity: 2D voxel (okay, pixel) physics

03 April 2016 - 12:50 PM

Do you know Cortex Command from Data Realms? It has some very nice pixel physics going on - maybe if you contact them, they will let you in on their methods?

### In Topic: Rope and sails?

22 January 2016 - 02:02 AM

yeah code would be good, as i mentioned earlier i need to simulate rope not sail, sail only moves rope that is attached to some fixed non movable end points (to make it easier), so then i can calculate the maximume translation of rope points between those two endpoints and fix cloth poisition. - wait i maybe wrote that wrong ;x - consider rope is undestructable it will bend somehow to some value and rope length wont change, this will help me position the cloth.

lets say i have a  rope that has 4 control point two fo them are end points that are not movable, now i apply a force to one of movable points lets say 1 million kilojoules (it should crack but dont mind our rope has godmode on) now those two control points will move only to some value and they wont deattach.

in my case ill do that: move cloth by wind, then whenever cloth point is attached to rope, check if it extends the rope ability to be bend and if yes correct the position of rope and cloth

Hello again! Simulating rope and sail are very similar, since a sail would simply be a tri- or quad-mesh of interconnected point masses and springs. Also, things doesn't work like you describe above. The ropes hold the sail up via the mast or masts, and transfer the wind-force applied on the sail to the hull of the ship. There are no "fixed points" that doesn't move. If your ropes are so soft and rubbery that they can't be used to propagate forces (that's what it looks like), then your simulation won't work. If you want a real physics simulation you'll have to start by reading up on how sailships work, because it's not as simple as you appear to think it is.

As for the problems you experience with your ropes: it appears that you use way too many point masses in them, since you have waves moving up and down through them, every time you move the fixed points. Also, the instability and oscillation you experience is notorious for bodies of interconnected springs. It can be removed by using more damping or less stiffnes, but the best way is to make an iterative solution.

Sorry in advance if I misunderstand you, I don't want to sound harsh or patronizing. :-)

Also, I promised you a code sample which is on its way. Cheers, Mike

### In Topic: Rope and sails?

17 January 2016 - 10:06 AM

Two things here:

First thing - As a seasoned sailer (viking ships) I'd like to point out that there is much more to sails than "the wind fills it like a bag and pushes the ship forward". What accellerates the ship is really the sucktion created *in front of* the sail, not the wind caught behind it. Sailships move considerably faster when the wind hits the sail edge-on, at a less-than 90 degree angle to the direction the ship is sailing in, than when the ship moves directly down wind, and the sail is expanded by the wind like a balloon. In other words, a sailship will move much faster at - say - 40 degrees up against the wind than with the wind coming directly from behind!  Programming this is going to be non-trivial.

Second thing - Ropes and sail (cloth) can easily be programmed with point masses and springs. If you implement an iterative method you'll get incredibly stable and rigid materials. I can give you some small, fuctional code samples to work with, but you may have to translate them to your own preferred programming language.

Cheers, Mike

PARTNERS