Source Box

A simple function to Create a dynamic Physics Block that reacts to gravity. This functions assumes that m_PhysicsSimulator is your JigLib physics simulator.

public static Body CreatePhysicsBox(Vector3 _Position, Matrix _Orientation, Vector3 _SideLengths, float _Mass)
            Body body;
            CollisionSkin collision;

            body = new Body();
            collision = new CollisionSkin(body);

            collision.AddPrimitive(new Box(-0.5f * _SideLengths, _Orientation, _SideLengths),
                                 new MaterialProperties(0.8f, 0.8f, 0.7f));
            body.CollisionSkin = collision;

            body.Mass = _Mass;

            body.MoveTo(_Position, Matrix.Identity);           


            return body;

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License