I'm trying to set up a vehicle as a single mesh with bones representing the different parts of the suspension. This will not only streamline car modeling, but open the door to tanks (ie the track can bend along with the wheel. I've got a bunch of code to tie the specific bones from the model to the correspondingly named wheel entities. All of that makes sense and seems to work.
func animate_wheels():
for wheel in wheel_bone_ids_to_entities:
var transl = wheel_bone_ids_to_entities[wheel].translation - wheel_initial_translations[wheel]
skel.set_bone_pose(wheel,
Transform(
Basis(Vector3(0,0,0)),
Vector3(transl.x, transl.y, transl.z)
)
)
print(wheel)
print(transl)
Now for the weird part: the bones all end up moving in different directions. Some wheels go up and down as expected, some go forward to backward, others side to side. The bones are all parented to the same bone and not rotated at different right angles as far as I can tell, so I'm struggling to figure out why they aren't all moving in the same direction. I can upload the files if that would help. Am I missing anything obvious in this setup?
I guess the question boils down to: how do you make sure that you're transforming bones in the right direction, in a programmatic fashion? (I could do this via trial and error, but that seems a waste of time.)