Fix LookAtModifier rest space rotation

This commit is contained in:
Silc Lizard (Tokage) Renew 2025-01-09 05:22:47 +09:00
parent 21a6bd8dca
commit 08a2f0ae39

View file

@ -501,9 +501,11 @@ void LookAtModifier3D::_process_modification() {
Transform3D bone_rest_space; Transform3D bone_rest_space;
int parent_bone = skeleton->get_bone_parent(bone); int parent_bone = skeleton->get_bone_parent(bone);
if (parent_bone < 0) { if (parent_bone < 0) {
bone_rest_space = skeleton->get_global_transform() * skeleton->get_bone_rest(bone); bone_rest_space = skeleton->get_global_transform();
bone_rest_space.origin += skeleton->get_bone_rest(bone).origin;
} else { } else {
bone_rest_space = skeleton->get_global_transform() * skeleton->get_bone_global_pose(parent_bone) * skeleton->get_bone_rest(bone); bone_rest_space = skeleton->get_global_transform() * skeleton->get_bone_global_pose(parent_bone);
bone_rest_space.origin += skeleton->get_bone_rest(bone).origin;
} }
// Calculate forward_vector and destination. // Calculate forward_vector and destination.