Browse Source

added inertia calculus

ncannasse 6 years ago
parent
commit
156dab749e
1 changed files with 2 additions and 0 deletions
  1. 2 0
      libs/bullet/bullet/Body.hx

+ 2 - 0
libs/bullet/bullet/Body.hx

@@ -16,6 +16,8 @@ class Body {
 
 
 	public function new( shape : Shape, mass : Float ) {
 	public function new( shape : Shape, mass : Float ) {
 		var inertia = new Native.Vector3(0, 0, 0);
 		var inertia = new Native.Vector3(0, 0, 0);
+		if( mass > 0 )
+			@:privateAccess shape.getInstance().calculateLocalInertia(mass,inertia);
 		state = new Native.DefaultMotionState();
 		state = new Native.DefaultMotionState();
 		var inf = new Native.RigidBodyConstructionInfo(mass, state, @:privateAccess shape.getInstance(), inertia);
 		var inf = new Native.RigidBodyConstructionInfo(mass, state, @:privateAccess shape.getInstance(), inertia);
 		inst = new Native.RigidBody(inf);
 		inst = new Native.RigidBody(inf);