there is something like translateLocal and translate, but i don’t know how to make a local rigidbody.applyImpulse
. pls help.
There isn’t one, there isn’t a concept of local space for physics simulation.
If you need something to go in the local direction of something, you can use the up
, forward
and right
properties of an entity. https://developer.playcanvas.com/en/api/pc.Entity.html#right
eg.
var impulse = this.entity.forward.clone();
impulse.scale(100);
this.entity.rigidbody.applyImpulse(impulse);
I think the impulse offset is in local space (API):
var impulse = new pc.Vec3(50, 0, 0);
var offset = new pc.Vec3(0.5, 0, 0);
this.entity.rigidbody.applyImpulse(impulse, offset);