예제 #1
0
        //Bullet callback updates Unity transform
        public override void SetWorldTransform(ref Matrix m)
        {
            UnityEngine.Vector3    position = BulletExtensionMethods.ExtractTranslationFromMatrix(ref m);
            UnityEngine.Quaternion rotation = BulletExtensionMethods.GetUnityRotationFromMatrix(ref m);

            _transform.SetPositionAndRotation(position, rotation);
        }
예제 #2
0
        public override void DrawSphere(float radius, ref BM.Matrix trans, ref BM.Vector3 color)
        {
            var pos   = BulletExtensionMethods.ExtractTranslationFromMatrix(ref trans);
            var rot   = BulletExtensionMethods.ExtractRotationFromMatrix(ref trans);
            var scale = BulletExtensionMethods.ExtractScaleFromMatrix(ref trans);
            var c     = new Color(color.X, color.Y, color.Z);

            BUtility.DebugDrawSphere(pos, rot, scale, Vector3.one * radius, c);
        }
예제 #3
0
        public override void DrawPlane(ref BM.Vector3 planeNormal, float planeConst, ref BM.Matrix trans, ref BM.Vector3 color)
        {
            var pos   = BulletExtensionMethods.ExtractTranslationFromMatrix(ref trans);
            var rot   = BulletExtensionMethods.ExtractRotationFromMatrix(ref trans);
            var scale = BulletExtensionMethods.ExtractScaleFromMatrix(ref trans);
            var c     = new Color(color.X, color.Y, color.Z);

            BUtility.DebugDrawPlane(pos, rot, scale, planeNormal.ToUnity(), planeConst, c);
        }
예제 #4
0
        public override void DrawCylinder(float radius, float halfHeight, int upAxis, ref BM.Matrix trans, ref BM.Vector3 color)
        {
            var pos   = BulletExtensionMethods.ExtractTranslationFromMatrix(ref trans);
            var rot   = BulletExtensionMethods.ExtractRotationFromMatrix(ref trans);
            var scale = BulletExtensionMethods.ExtractScaleFromMatrix(ref trans);
            var c     = new Color(color.X, color.Y, color.Z);

            BUtility.DebugDrawCylinder(pos, rot, scale, radius, halfHeight, upAxis, c);
        }
예제 #5
0
        public override void DrawBox(ref BM.Vector3 bbMin, ref BM.Vector3 bbMax, ref BM.Matrix trans, ref BM.Vector3 color)
        {
            var pos   = BulletExtensionMethods.ExtractTranslationFromMatrix(ref trans);
            var rot   = BulletExtensionMethods.ExtractRotationFromMatrix(ref trans);
            var scale = BulletExtensionMethods.ExtractScaleFromMatrix(ref trans);
            var size  = (bbMax - bbMin).ToUnity();
            var c     = new Color(color.X, color.Y, color.Z);

            BUtility.DebugDrawBox(pos, rot, scale, size, c);
        }
예제 #6
0
        public override void DrawTransform(ref BM.Matrix trans, float orthoLen)
        {
            var pos = BulletExtensionMethods.ExtractTranslationFromMatrix(ref trans);
            var rot = BulletExtensionMethods.ExtractRotationFromMatrix(ref trans);
            var p1  = pos + rot * Vector3.up * orthoLen;
            var p2  = pos - rot * Vector3.up * orthoLen;

            Gizmos.DrawLine(p1, p2);
            p1 = pos + rot * Vector3.right * orthoLen;
            p2 = pos - rot * Vector3.right * orthoLen;
            Gizmos.DrawLine(p1, p2);
            p1 = pos + rot * Vector3.forward * orthoLen;
            p2 = pos - rot * Vector3.forward * orthoLen;
            Gizmos.DrawLine(p1, p2);
        }