Want to reproduce the movement like a motor

Want to reproduce the movement like a motor.

I am trying to implement the movement like a motor in physical space using havok.

I need to make a rotating object rotate in the same direction no matter what direction it is facing.

I have implemented the following as a test

.setAngularVelocity(new BABYLON.Vector3(0, 0, 1));

and I was able to rotate it, but there are some flaws, such as the rotation direction changes when I change the orientation of the underlying object.

Does anyone know how to make it rotate in a certain direction?

I tried to set all frictions to 0 (ground, cylinder, box) and set the angular velocities only once, hoping the movement would last forever, but it comes to an halt after some time:

Let’s cc @Cedric to help!


I would do the same with setting angular/linear velocity each frame.
For the orientation, tranform the force direction from local to world space like this:


@Cedric @Evgeni_Popov

Thanks to all of you for your help.

1 Like


Utilizing what you taught me, I was able to create a SLIDER CRANK MECHANISM.
Thanks again.


That’s amazing! nice work, I love it!

1 Like

so cool :slight_smile:

1 Like