mirror of
https://github.com/godotengine/godot.git
synced 2024-11-23 04:33:29 +00:00
Merge pull request #48310 from Blackiris/fix-create-skeleton-physical-bones-4.0
This commit is contained in:
commit
600ff3a221
@ -419,8 +419,14 @@ PhysicalBone3D *Skeleton3DEditor::create_physical_bone(int bone_id, int bone_chi
|
||||
capsule_transform.basis = Basis(Vector3(1, 0, 0), Vector3(0, 0, 1), Vector3(0, -1, 0));
|
||||
bone_shape->set_transform(capsule_transform);
|
||||
|
||||
/// Get an up vector not collinear with child rest origin
|
||||
Vector3 up = Vector3(0, 1, 0);
|
||||
if (up.cross(child_rest.origin).is_equal_approx(Vector3())) {
|
||||
up = Vector3(0, 0, 1);
|
||||
}
|
||||
|
||||
Transform3D body_transform;
|
||||
body_transform.basis = Basis::looking_at(child_rest.origin);
|
||||
body_transform.basis = Basis::looking_at(child_rest.origin, up);
|
||||
body_transform.origin = body_transform.basis.xform(Vector3(0, 0, -half_height));
|
||||
|
||||
Transform3D joint_transform;
|
||||
|
Loading…
Reference in New Issue
Block a user