Source Sphere

This simple function creates a Physics Sphere that reacts to gravity. It assumes that m_PhysicsSystem is your JigLib physics system that you have previously setup in the class.

public static Body CreatePhysicsSphere(Vector3 _Pos, float _Radius, float _Mass)
            Body body;
            CollisionSkin collision;

            body = new Body();
            collision = new CollisionSkin(body);
            collision.AddPrimitive(new Sphere(Vector3.Zero * 5.0f, _Radius),
                            new MaterialProperties(0.5f, 0.7f, 0.6f));
            body.CollisionSkin = collision;
            body.Mass = _Mass;
            body.MoveTo(_Pos, Matrix.Identity);           


            return body;

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