# [Solved] You spin me right round baby! Torque issues

My spaceship is moving forward and backward perfectly using

``````ship_phy.setDamping(0.9f, 1f);

Vector3f thrustVec = new Vector3f(0, 0, maxThrust * throttlePercentage);

thrustVec = ship_phy.getPhysicsRotation().mult(thrustVec);

ship_phy.applyCentralForce(thrustVec);``````

So the ship slows down after you 0 the thrust and coasts to a nice stop.

Huzzah!

Now to turn.

I’m using torque.

``ship_phy.applyTorque(new Vector3f(0, maxTorque * tpf, 0));``

That’s for turning to port(left).

But the dampening doesn’t appear to affect that the same way it does for thrust. It just turns endlessly without slowing down.

Am I wrong in thinking that dampening doesn’t affect torque?

I know the method isn’t javadoc’ed… but what do you suppose the two values do?

…especially when you consider that there are also separate setLinearDamping and setAngularDamping methods…

1 Like

Well that’s what I figured. Which is why I’m confused. The Linear Damping value appears to work at 0.9f but the Angular doesn’t seem to do squat with similar values.

I just set it to 1000000f for Angular at it just spins in place if I give it a touch of torque once.

Argh. Ok. Found the issue. It was me being a bit dense.

I apologize.

Just for everyone else’s possible blunders (but really I doubt anyone will do the same thing) here’s what was going on.

Since I move “space” while keeping the ship still I apply the force on a physics object of the ship and move the world inversely to the movement of the ship.

So if I move the ship forward 10 units I move the world backwards 10 units while keeping the ship still.

When it came to rotation though I applied Torque to the physics body and then applied the rotation Quaternion of the physics body to the world space inversely…

BUT!!!

I was doing that by applying the current rotation of the physics body

``ship_phy.getPhysicsRotation();``

To the node containing space like this

``space.rotate(ship_phy_rot_quaternion.inverse());``

This has an additive effect on the space node. So although the ship had stopped rotating it was still applying the rotation value to the space node.

``ship_phy.getAngularVelocity();``
``space.rotate(-angularVelocity.x, -angularVelocity.y, -angularVelocity.z);``