Пример #1
0
        public BoxCollider(RigidBody body)
        {
            var shape = (BoxShape)body.CollisionShape;

            if (shape == null)
            {
                throw new ArgumentException("The body shape does not match the collider!", "body.CollisionShape");
            }

            Model = Primitives.Cube(shape.HalfExtentsWithMargin.X, shape.HalfExtentsWithMargin.Y, shape.HalfExtentsWithMargin.Z, MeshMaterial.Green);
            Body  = body;

            _size = new Vector3(shape.HalfExtentsWithMargin.X, shape.HalfExtentsWithMargin.Y, shape.HalfExtentsWithMargin.Z);
        }
Пример #2
0
 Polytope GenerateCube() => Primitives.Cube(2);