private static void GetJointBodyPairSprtOffset(out double distance, out Quaternion rotation, AddJointBodyType bodyType) { switch (bodyType) { case AddJointBodyType.Box_Corner: distance = Math.Sqrt(3d); //TODO: Figure out how to rotate a cube onto its corner rotation = new Quaternion(new Vector3D(0, 0, 1), 45d).ToUnit() * new Quaternion(new Vector3D(0, 1, 0), 45d).ToUnit(); //rotation = new Quaternion(new Vector3D(0, 0, 1), 45d).ToUnit() + new Quaternion(new Vector3D(0, 1, 0), 45d).ToUnit() + new Quaternion(new Vector3D(1, 0, 0), 45d).ToUnit(); break; case AddJointBodyType.Box_Edge: distance = Math.Sqrt(2d); rotation = new Quaternion(new Vector3D(0, 0, 1), 45d); break; case AddJointBodyType.Cone_Tip: //TODO: Finish these distance = 1d; rotation = new Quaternion(new Vector3D(0, 0, 1), 180d); break; case AddJointBodyType.Cylinder_Edge: distance = 1d; rotation = new Quaternion(new Vector3D(0, 0, 1), 90d); break; case AddJointBodyType.Box_Face: case AddJointBodyType.Cone_Base: case AddJointBodyType.Cylinder_Cap: case AddJointBodyType.Sphere: distance = 1d; rotation = new Quaternion(new Vector3D(0, 0, 1), 0d); break; default: throw new ApplicationException("Unknown AddJointBodyType: " + bodyType.ToString()); } }
private static CollisionShapeType GetJointBodyPairSprtHullType(AddJointBodyType bodyType) { switch (bodyType) { case AddJointBodyType.Box_Corner: case AddJointBodyType.Box_Edge: case AddJointBodyType.Box_Face: return(CollisionShapeType.Box); case AddJointBodyType.Cone_Base: case AddJointBodyType.Cone_Tip: return(CollisionShapeType.Cone); case AddJointBodyType.Cylinder_Cap: case AddJointBodyType.Cylinder_Edge: return(CollisionShapeType.Cylinder); case AddJointBodyType.Sphere: return(CollisionShapeType.Sphere); default: throw new ApplicationException("Unknown AddJointBodyType: " + bodyType.ToString()); } }
private static CollisionShapeType GetJointBodyPairSprtHullType(AddJointBodyType bodyType) { switch (bodyType) { case AddJointBodyType.Box_Corner: case AddJointBodyType.Box_Edge: case AddJointBodyType.Box_Face: return CollisionShapeType.Box; case AddJointBodyType.Cone_Base: case AddJointBodyType.Cone_Tip: return CollisionShapeType.Cone; case AddJointBodyType.Cylinder_Cap: case AddJointBodyType.Cylinder_Edge: return CollisionShapeType.Cylinder; case AddJointBodyType.Sphere: return CollisionShapeType.Sphere; default: throw new ApplicationException("Unknown AddJointBodyType: " + bodyType.ToString()); } }