SetEulerAngles doing strange things

In this project: I’m trying the 2dPhysics integration to see if it makes the overall project easier, and it may be because of that that I’m experiencing this issue. The issue is, I have a script (manager.js) on the root of my project that is meant to control everything. In it, I try to set the euler angles of the main wheel entity to a randomly selected angle from a list of angles. The odd thing is, when I do this.entity.setEulerAngles the wheel set itself perfectly fine, but if I try to get the wheel by some other means (the attribute it’s assigned to or app.root.findbyName('wheel'), it doesn’t set. I thought using this.entity was supposed to apply to the entity the script was attached to, why is it affecting an entity it’s not attached to?

Can you provide an example of what you mean? Or at provide the scripts and line numbers in question,?

Of course, here you go. Manager.js It’s line 19-21. I’ve tried putting it into another script on the wheel entity itself, and it still wouldn’t set the angles right, always went to 0 rotation as well as using the attribute I called model to try and set it. But for some reason setting the angles for the root entity makes the wheel entity set to the right angle. If that’s a clearer explanation.

this.entity in a script is a reference to the entity object that an instance of the script is attached to.

In this case, as the manager script is on the Root entity, you are trying to set the euler angles of the Root entity.

On another note, bear in mind that the physics is going to override any positional/rotational values that you set directly to the entity as the simulation will be setting those values.

Which is what is weird, because the wheel entity is the only thing in the scene that appears to change when I set the angles that way.

Right, so I should go about setting the angle using the attributes of the 2d physics scripts, which I have tried with no luck.

EDIT: Perhaps I’m just going about it the wrong way, instead of setting the angle of the entire entity, I should just set the angle of the visible model.