I found something wrong with setLocalEulerAngles API

I found something wrong when I use setLocalEulerAngles API to rotate my entity.

So I create a new project to test this bug and I found something wrong.

This is my description:

I turn on the RIGID BODY and COLLISION component with the Box in EDITOR

just like this:

And then,I add a script with the Box:

You can see I use setLocalEulerAngles API and I want to rotate the entity.

However,I found that is no effect in the Launch.

The entity don’t rotate.

But,when I delete the COLLISION component of Box in EDITOR

Then,I can found the entity can be rotated.

So, I am so confused with this.

Could anyone help me?

This is my test project

https://playcanvas.com/editor/scene/459781

Even I turn off the COLLISION component,

the entity can’t be rotated.

Only I delete the COLLISION component,

the entity can be rotated.

This isn’t a bug. As soon as you add rigidboyd and collision components, you hand responsibility of setting the entity’s transform to the physics engine. setLocalEulerAngles (and the other entity transform functions have an effect). To override the physics engine’s control of the entity (say for teleporting a rigid body entity somewhere) use the teleport function. This it outlined in the user manual. So what you need to do is:

    this.entity.rigidbody.teleport(0, 0, 0, 0, 45, 0);
1 Like

Dear Will ,

Thank you so much !

Your answer help my problem and I success to rotate the entity with the teleport function !