I thought calling rotate directly on a Spatial would rotate it around “itself” as in around its geometric center. However, I’m working on an imported model now trying to rotate “sub-spatials” of a larger model, and find that a call to Spatial.rotate(0.1f, 0, 0) for a x-axis rotation for example makes the Spatial move in a circle in the XY-plane, indicating that the origin for the axis system that the spatial is rotating around is somewhere off in space, and away from the object itself.
How did this happen? Does Spatial.rotate in the end rotate around the origin defined by the model it “belongs” to as a whole, not the geometric origin of the spatial?
Yeah, the BoundingBox center is at (0.12681948, 0.042627037, 0.8830446) while the local translation is (0, 0, 0). I thought the two would match up given that no transforms has been applied to it yet but the bounding volume might be determined at import time to something different?
The problem with attaching it to it’s own node is that it need to stay attached to the larger object for when that object moves. Think wheels on a moving car. I want so spin the wheel on it’s own axis while the car is moving and rotating.
There’s probably an easy way to design a node hierarchy here that will work, I’m just unfamiliar with this.
I’ve tried this - attaching the wheel to it’s own wheelnode, then attaching the wheelnode to the car, then rotating the car and the wheelnode. It seemed like the logical thing to do but I can’t get it to work.
I’ll just have to work with a simple experiment until I figure this out, thanks. I am however perplexed as to why the method suggested by pspeed leads to no rotation at all for the spatial once it is attached to the larger body.