- Edited
I'm trying to rotate a bone by an angle and an axis I have already calculated. I've tested this angle and axis by rotating a Mesh Instance, and it works perfectly. I checked the calculations and they look right (the axis is found by taking the cross product of the two vectors making up the angle). However, when I try to rotate the bone by the same values, it rotates by the correct angle, but the axis is suddenly different (it should be rotating up, but it rotates to the left). I'm pretty sure the bone is rotating locally relative to something, because when I change the bones orientation it rotates in a different direction every time. I've tried using .get_bone_global_pose()
, but for some reason the bone gets stretched out in a weird direction instead of just rotating.
This is my code in gdscript:
(the vector is the Mesh Instance, and the rotation and axis is correct)
vector.rotate(axis, angle)
( the bone is rotated by the same values, but the axis is wrong)
bonePose = skel.get_bone_pose(id)
bonePose = bonePose.rotated(axis, angle)
skel.set_bone_pose(id, bonePose)