Apply force to local space instead world space

How can i apply force to local space of wheel?
You can press a/d for movement left/right.

and how can i limit rotation for ratate just around x axis?

You can use 6 degrees of freedom constraints.
https://doc.babylonjs.com/features/featuresDeepDive/physics/constraints#constraint-types

Here is an example playground:
https://playground.babylonjs.com/#BR2YCM#15.

1 Like

Thanks.But how to apply force in local space instead of world space?

For local space you can call TransformNode.getDirection or TransformNode.getDirectionToRef.

You will want to call it on a mesh that isn’t spinning around like the wheel does, though, so you need to connect the wheel to a stable “chassis” with a 6 degrees of freedom constraint, like in this playground:

https://playground.babylonjs.com/#KDPAQ9#5773.

2 Likes

Thanks