コード例 #1
0
ファイル: CollisionBox2d.cs プロジェクト: raizam/GeonBit
        /// <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));
        }
コード例 #2
0
ファイル: CollisionConvexHull.cs プロジェクト: raizam/GeonBit
        /// <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));
        }
コード例 #3
0
        /// <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));
        }
コード例 #4
0
        /// <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)));
        }
コード例 #5
0
ファイル: CollisionTriangle.cs プロジェクト: raizam/GeonBit
        /// <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])));
        }