How to get local forward

how can I get local forward?
in unity I use this

transform.parent.InverseTransformDirection(transform.forward);

You can get for the entity the vector of its forward direction using this property.

my balls rotate and I want to get forward direction where they facing
vec3.FORWARD isn’t good because It prevent to getting rotation
this.entity.forward isn’t because I don’t need rotation in z axis
I need forward direction that get in Y axis

If I understand you correctly, then you need a direction for the entity along the Y axis. For the Y axis, there is another property up. In total, there are 3 direction vectors available for the entity - forward, up and right. To get the other directions, you must use negative values of these vectors.

1 Like

If you want to do operations like the example you have shown for unity, you can get the transform of the entity here https://developer.playcanvas.com/en/api/pc.Entity.html#getLocalTransform

This gives you a matrix 4 * 4 which you can use to transform a vector https://developer.playcanvas.com/en/api/pc.Mat4.html#transformVec4

1 Like