Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhysicsWorld"/> class.
 /// </summary>
 /// <param name="gravity">The gravity.</param>
 public PhysicsWorld(Vector2 gravity)
     : this()
 {
     ContactManager = new ContactManager(new DynamicTreeBroadPhase());
     Gravity = gravity;
 }
Esempio n. 2
0
        public void Reset(int bodyCapacity, int contactCapacity, int jointCapacity, ContactManager contactManager)
        {
            _bodyCapacity = bodyCapacity;
            _contactCapacity = contactCapacity;
            _jointCapacity = jointCapacity;

            BodyCount = 0;
            ContactCount = 0;
            JointCount = 0;

            _contactManager = contactManager;

            if (Bodies == null || Bodies.Length < bodyCapacity)
            {
                Bodies = new PhysicsBody[bodyCapacity];
            }

            if (_contacts == null || _contacts.Length < contactCapacity)
            {
                _contacts = new Contact[contactCapacity * 2];
            }

            if (_joints == null || _joints.Length < jointCapacity)
            {
                _joints = new PhysicsJoint[jointCapacity * 2];
            }
        }
Esempio n. 3
0
 public PhysicsWorld(Vector2 gravity, AABB span)
     : this()
 {
     Gravity = gravity;
     ContactManager = new ContactManager(new QuadTreeBroadPhase(span));
 }