How to applyImpulse on object axis intead of global axis?

I’m fairly new to 3D render, so this may be a really noob questiong.

I have a car mesh and I want to apply an impulse forward (object’s x axis), even if the car is facing the global z axis, how do I do it?
To be honest I don’t even found a away to create/determine a object’s axis.
Here’s the playground link: https://playground.babylonjs.com/#93HGU7#74

Thank you

Hi @marioaleo and welcome to the forum!
I think impulse are applied in the local space.
Do you have a playground to test it?

Oh, forgot to link it, but here it is: https://playground.babylonjs.com/#93HGU7#74

Here is an example PG:

check line 27 for changing object orientation

important part is line 36. the matrix is retrieved from the box and the direction vector is used for impulse.

2 Likes

Thank you :smiley:

1 Like