What’s the best way to set an axis rotation to a number other than what it is without the axis moving?
So, after positioning an item in a scene the z axis shows to be at 270 degrees but I would like it reset to 0 degrees and the axis position to remain in the same spot. I can probably use an offset but first I like to try to reset it. Can’t seem to find an example playground that does this type of reset.
The best way to achieve this is by using the bakeCurrentTransformIntoVertices() method. This “reset” the current rotation to the mesh geometry and resets the rotation values to zero without moving the object visually.
Check out the example in the Playground to demonstrate this, in which a small trick was added to ensure that the pivot point stays at the center of the mesh during the reset.
Not really! The method works on local space, so it will reset the child’s rotation to zero relative to its parent while maintaining its visual orientation. The logic remains the same.
Thanks for the information. I’ve just about got it all working but I’ll ask another question.
bakeCurrentTransformIntoVertices() basically zeros out all axes without visually moving them. If I wanted to do this then set one of the axis to something other than 0 can this be done without a visual change? Maybe something like this…
bakeCurrentTransformIntoVertices() rotation set to 0,0,0