long stick behaviour in the air
Posted: Tue Nov 12, 2013 6:35 pm
I'm actually asking for help in making my own physics engine.
Some physics engines conserve the angular velocity of an object spinning in the air with no friction. I don't know if bullet does this.
However, according to physics books the angular momentum needs to be conserved.
To convert between angular velocity and angular momentum you need the inertia tensor. In case of a sphere or cube, this will be only-diagonal, with the same number, making the angular velocity always parallel to the angular momentum, and constant.
However, in case of a long piece of stick, the tensor is more distorted such as this:
50, 0, 0,
0, 0.1, 0,
0 , 0, 50
In this case the angular velocity and the angular momentum can be far from parallel.
Converting the preserved angular momentum to angular velocity in every frame (120HZ) can do the trick for less thin sticks, but due to the quantization it rotates off the track, resulting in changing it's kinetic energy, and strange speedups.
I also modelled the same thing using wireframe physics, connecting dots with springs/dampers to simulate a long stick. In this test the angular velocity wasn't preserved, but the kinetic energy and the angular momentum was, and it looked right.
My question is simple, how to rotate long objects properly?
Some physics engines conserve the angular velocity of an object spinning in the air with no friction. I don't know if bullet does this.
However, according to physics books the angular momentum needs to be conserved.
To convert between angular velocity and angular momentum you need the inertia tensor. In case of a sphere or cube, this will be only-diagonal, with the same number, making the angular velocity always parallel to the angular momentum, and constant.
However, in case of a long piece of stick, the tensor is more distorted such as this:
50, 0, 0,
0, 0.1, 0,
0 , 0, 50
In this case the angular velocity and the angular momentum can be far from parallel.
Converting the preserved angular momentum to angular velocity in every frame (120HZ) can do the trick for less thin sticks, but due to the quantization it rotates off the track, resulting in changing it's kinetic energy, and strange speedups.
I also modelled the same thing using wireframe physics, connecting dots with springs/dampers to simulate a long stick. In this test the angular velocity wasn't preserved, but the kinetic energy and the angular momentum was, and it looked right.
My question is simple, how to rotate long objects properly?