//Bullet calls this so I can copy bullet data to unity
 public override void SetWorldTransform(ref BM.Matrix m)
 {
     transform.position = BSExtensionMethods2.ExtractTranslationFromMatrix(ref m);
     transform.rotation = BSExtensionMethods2.ExtractRotationFromMatrix(ref m);
 }
 // Object A has the constraint compontent and is constrainted to object B
 // The constraint frame is defined relative to A by three vectors.
 // This method calculates the frames A and B that need to be passed to bullet
 public bool CreateFramesA_B(UnityEngine.Vector3 forwardInA, UnityEngine.Vector3 upInA, UnityEngine.Vector3 constraintPivotInA, out BM.Matrix frameInA, out BM.Matrix frameInB, ref string errorMsg)
 {
     frameInA = BM.Matrix.Identity;
     if (!CreateFrame(forwardInA, upInA, constraintPivotInA, ref frameInA, ref errorMsg))
     {
         frameInB = BM.Matrix.Identity;
         return false;
     }
     BM.Vector4 x = frameInA.Row1;
     BM.Vector4 y = frameInA.Row2;
     BM.Vector4 z = frameInA.Row3;
     Vector3 xx = new Vector3(x.X, x.Y, x.Z);
     Vector3 yy = new Vector3(y.X, y.Y, y.Z);
     Vector3 zz = new Vector3(z.X, z.Y, z.Z);
     Quaternion q = transform.localRotation * Quaternion.Inverse(m_otherRigidBody.transform.localRotation);
     xx = q * xx;
     yy = q * yy;
     zz = q * zz;
     frameInB = BM.Matrix.Identity;
     frameInB.Row1 = new BM.Vector4(xx.ToBullet(), 0f);
     frameInB.Row2 = new BM.Vector4(yy.ToBullet(), 0f);
     frameInB.Row3 = new BM.Vector4(zz.ToBullet(), 0f);
     frameInB.Origin = m_otherRigidBody.transform.InverseTransformPoint(transform.TransformPoint(constraintPivotInA)).ToBullet();
     return true;
 }
 //Bullet wants me to fill in worldTrans
 //This is called by bullet once when rigid body is added to the the world
 //For kinematic rigid bodies it is called every simulation step
 //[MonoPInvokeCallback(typeof(GetTransformDelegate))]
 public override void GetWorldTransform(out BM.Matrix worldTrans)
 {
     BulletSharp.Math.Vector3 pos = transform.position.ToBullet();
     BulletSharp.Math.Quaternion rot = transform.rotation.ToBullet();
     BulletSharp.Math.Matrix.AffineTransformation(1f, ref rot, ref pos, out worldTrans);
 }