engine icon indicating copy to clipboard operation
engine copied to clipboard

Add method for Node

Open AlexAPPi opened this issue 1 year ago • 2 comments

Now there are 2 methods available, setPosition and setRotation, I suggest adding 1 more method setPositionAndRotation.

public setPositionAndRotation(position: Readonly<pc.Vec3>, rotation: Readonly<pc.Quat>): void;

  • This will further optimize position and rotation manipulations

AlexAPPi avatar Apr 30 '24 09:04 AlexAPPi

I think we have an equivalent, or at least it is similar:

entity.getWorldTransform().setTRS(position, rotation, pc.Vec3.ONE);

LeXXik avatar Apr 30 '24 09:04 LeXXik

A much bigger optimization many miss is to use setLocalPosition instead of setPosition where possible.

Maksims avatar Apr 30 '24 09:04 Maksims

@AlexAPPi So ive done some performance testing in #6625 and it doesn't seem like the performance gain is reasonable enough to warrant adding this method right now. If this issue was created for a personal project the chances of optimizing other areas would be much more successful that attempting to include this

kpal81xd avatar May 28 '24 12:05 kpal81xd