public virtual void CreateFromCollisionObject(HkShape shape, Vector3 center, MatrixD worldTransform, HkMassProperties? massProperties = null, int collisionFilter = MyPhysics.DefaultCollisionLayer) { MyPhysics.AssertThread(); VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyPhysicsBody::CreateFromCollisionObject()"); Debug.Assert(RigidBody == null, "Must be removed from scene and null"); CloseRigidBody(); Center = center; CanUpdateAccelerations = true; //m_motionState = new MyMotionState(worldTransform); CreateBody(ref shape, massProperties); RigidBody.UserObject = this; //RigidBody.SetWorldMatrix(worldTransform); RigidBody.Layer = collisionFilter; if ((int)(Flags & RigidBodyFlag.RBF_DISABLE_COLLISION_RESPONSE) > 0) { RigidBody.Layer = MyPhysics.NoCollisionLayer; } if ((int)(Flags & RigidBodyFlag.RBF_DOUBLED_KINEMATIC) > 0) { HkRigidBodyCinfo rbInfo2 = new HkRigidBodyCinfo(); rbInfo2.AngularDamping = m_angularDamping; rbInfo2.LinearDamping = m_linearDamping; rbInfo2.Shape = shape; rbInfo2.MotionType = HkMotionType.Keyframed; rbInfo2.QualityType = HkCollidableQualityType.Keyframed; RigidBody2 = new HkRigidBody(rbInfo2); RigidBody2.UserObject = this; RigidBody2.SetWorldMatrix(worldTransform); } //m_motionState.Body = this; VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock(); }