protected update() {
let rotateValue = 1;
let eulerAngles = this.node.eulerAngles.clone();
eulerAngles = new Vec3(eulerAngles.x, eulerAngles.y, eulerAngles.z + rotateValue);
this.node.setRotationFromEuler(eulerAngles);
}
in the above code it will just stop at 90 degrees which faces left. I could do it using this.node.angle+= rotateValue, but I can’t get the angle when the node’s rigidbody2D is having angular velocity, I can only get the angle using this.node.eulerAngles in this situation, so I tried to set the angle using this.node.angle and get the angle using this.node.eulerAngles, then when I calculate the rotateValue using this.node.eulerAngles.z, the original functional code using this.node.angle can’t rotate more than ±90 degrees…
eulerAngles is a Vec3, x and y will be 0, 180, or -180, Math.abs(z) will not be more than 90, I don’t know how the engine works, but I can assign the value of eulerAngles.z to this.node.angle this.node.angle = this.node.eulerAngles.z;
then use this.node.angle to calculate the rotateValue, then add the value to this.node.angle, this way the node can rotate more than 90, but when I get the eulerAngles in physics simulation, the rotation becomes so weird that it rotates very very fast
It’s just actually the problem of how to rotate more than 90 degrees using the Vec3 of eulerAngles instead of this.node.angle, any thought would be very appreciated!