ammo.js after calling applyTorque how to update the force direction?

405 Views Asked by At

I am using ammo.js to create a simple demo.

I have a 3d object in the world and I can make it move with the following code:

cubeObject.applyForce(new Vec3(10, 0, 0));

It will move along the x-axis and then stop gradually.

Now I want to make it to turn a little bit (imagine a car turning):

cubeObject.applyTorque(new Vec3(0, 1000, 0));

After calling this code, the cube (car) dose turn a certain degree (this is good as expected).

But the problem is, the car is still moving along the x-axis instead of moving towards the direction it is facing (after turning).

I do not know what I am missing here.

Any advice will be appreciated, thank :)

0

There are 0 best solutions below