/// <summary> /// Clone the physical shape. /// </summary> /// <returns>Cloned shape.</returns> protected override ICollisionShape CloneImp() { var shape = _shape as BulletSharp.Box2DShape; Vector3 halfExtent = ToMonoGame.Vector(shape.HalfExtentsWithoutMargin); return(new CollisionBox2D(halfExtent.X * 2f, halfExtent.Y * 2f, halfExtent.Z * 2f)); }
/// <summary> /// Clone the physical shape. /// </summary> /// <returns>Cloned shape.</returns> protected override ICollisionShape CloneImp() { // extract points from shape var shape = _shape as BulletSharp.ConvexHullShape; Vector3[] points = new Vector3[shape.NumPoints]; int i = 0; foreach (var point in shape.Points) { points[i++] = ToMonoGame.Vector(point); } // create and return clone return(new CollisionConvexHull(points)); }
/// <summary> /// Clone the physical shape. /// </summary> /// <returns>Cloned shape.</returns> protected override ICollisionShape CloneImp() { var shape = _shape as BulletSharp.CylinderShape; return(new CollisionCylinder(ToMonoGame.Vector(shape.HalfExtentsWithoutMargin), _axisType)); }
/// <summary> /// Clone the physical shape. /// </summary> /// <returns>Cloned shape.</returns> protected override ICollisionShape CloneImp() { var shape = _shape as BulletSharp.StaticPlaneShape; return(new CollisionEndlessPlane(ToMonoGame.Vector(shape.PlaneNormal))); }
/// <summary> /// Clone the physical shape. /// </summary> /// <returns>Cloned shape.</returns> protected override ICollisionShape CloneImp() { var shape = _shape as BulletSharp.TriangleShape; return(new CollisionTriangle(ToMonoGame.Vector(shape.Vertices[0]), ToMonoGame.Vector(shape.Vertices[1]), ToMonoGame.Vector(shape.Vertices[2]))); }