Parcourir la source

Merge pull request #129 from Jason0214/fix_collisionShape_children_transform

fix transform matrix of children of CollisionShape
Lu Jiacheng il y a 6 ans
Parent
commit
b7fca53a2a

+ 3 - 2
io_scene_godot/export_godot.py

@@ -125,8 +125,9 @@ class GodotExporter:
         # and godot, so it has a -90 rotation around X axis,
         # here rotate its children back
         if exported_node.parent.get_type() == 'CollisionShape':
-            exported_node['transform'] *= (
-                mathutils.Matrix.Rotation(math.radians(90), 4, 'X'))
+            exported_node['transform'] = (
+                mathutils.Matrix.Rotation(math.radians(90), 4, 'X') *
+                exported_node['transform'])
 
         # if the blender node is exported and it has animation data
         if exported_node != parent_gd_node:

+ 1 - 1
tests/reference_exports/action_animation/physics_animation.escn

@@ -97,4 +97,4 @@ anims/Cube.003Action.001 = SubResource(4)
 
 mesh = SubResource(5)
 visible = true
-transform = Transform(1.65289, 0.0, 0.0, 0.0, 1.2479e-07, -1.65289, 0.0, 1.65289, 1.2479e-07, 0.0, 4.76837e-07, 0.0)
+transform = Transform(1.65289, 0.0, 0.0, 0.0, 1.2479e-07, -1.65289, 0.0, 1.65289, 1.2479e-07, 0.0, 3.60002e-14, 4.76837e-07)

+ 1 - 1
tests/reference_exports/armature/armature_with_physics.escn

@@ -45,7 +45,7 @@ shape = SubResource(1)
 
 [node name="Rig" type="Skeleton" parent="PhysicsPhysics/PhysicsCollision"]
 
-transform = Transform(1.0, 0.0, 0.0, 0.0, 7.54979e-08, -1.0, 0.0, 1.0, 7.54979e-08, 0.0, -0.7, 0.0)
+transform = Transform(1.0, 0.0, 0.0, 0.0, 7.54979e-08, -1.0, 0.0, 1.0, 7.54979e-08, 0.0, -5.28485e-08, -0.7)
 bones/0/name = "Bone"
 bones/0/parent = -1
 bones/0/rest = Transform(1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, -0.1, 0.0)