Notifications
Clear all

[Closed] Rotation Issues

I’m trying to get a sphere to be rotated by two spinners, the first spinner controls horizontal orientation the 2nd Vertical. But I can’t get the rotation working in the correct space.

thesphere.rotation = eulertoquat (eulerAngles (spn_HRotate.value - 90) (spn_VertRotate.value * -1) 0) order:6

Using this I’ve got the sphere to rotate horizontally correctly, or Vertically correctly but if i use both then the rotations are applied in world coordsys.

If I change it to ‘in coordsys local’ or ‘in coordsys thesphere’ it ‘should’ work, but then the rotation freaks out even just rotating horizontally gives strange values…

in coordsys thesphere thesphere.rotation = eulertoquat (eulerAngles (270 + spn_HRotate.value - 360) (spn_VertRotate.value * -1) 0) order:6

Where am I going wrong? All I want is for it to rotate around Z and then Y locally…

1 Reply
1 Reply
(@mikiek)
Joined: 11 months ago

Posts: 0

Have you looked at setting theSphere.rotation.x_rotation and theSphere.rotation.y_rotation directly? they are already euler, and might be a bit easier without the extra euler to quat conversion…

working in coordsys gimbal might also help, if you’re getting wierd results… It will basically return the values you see in the transform spinners i.e. you can both get and set values in that coordinate system.

in coordsys gimbal theSphere.rotation.x_rotation

in coordsys gimbal theSphere.rotation.x_rotation = 0

Mikie