//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); }
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); }
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); }
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); }
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); }
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); }