Example #1
0
        public void Reset(int bodyCapacity, int contactCapacity, int jointCapacity, FSContactManager contactManager)
        {
            BodyCapacity    = bodyCapacity;
            ContactCapacity = contactCapacity;
            JointCapacity   = jointCapacity;
            BodyCount       = 0;
            ContactCount    = 0;
            JointCount      = 0;

            _contactManager = contactManager;

            if (Bodies == null || Bodies.Length < bodyCapacity)
            {
                Bodies      = new FSBody[bodyCapacity];
                _velocities = new Velocity[bodyCapacity];
                _positions  = new Position[bodyCapacity];
            }

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

            if (_joints == null || _joints.Length < jointCapacity)
            {
                _joints = new FarseerJoint[jointCapacity * 2];
            }
        }
Example #2
0
 public FSWorld(FVector2 gravity, AABB span)
     : this()
 {
     Gravity = gravity;
     ContactManager = new FSContactManager(new QuadTreeBroadPhase(span));
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FSWorld"/> class.
 /// </summary>
 /// <param name="gravity">The gravity.</param>
 public FSWorld(FVector2 gravity)
     : this()
 {
     ContactManager = new FSContactManager(new DynamicTreeBroadPhase());
     Gravity = gravity;
 }
Example #4
0
        public void Reset(int bodyCapacity, int contactCapacity, int jointCapacity, FSContactManager contactManager)
        {
            BodyCapacity = bodyCapacity;
            ContactCapacity = contactCapacity;
            JointCapacity = jointCapacity;
            BodyCount = 0;
            ContactCount = 0;
            JointCount = 0;

            _contactManager = contactManager;

            if (Bodies == null || Bodies.Length < bodyCapacity)
            {
                Bodies = new FSBody[bodyCapacity];
                _velocities = new Velocity[bodyCapacity];
                _positions = new Position[bodyCapacity];
            }

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

            if (_joints == null || _joints.Length < jointCapacity)
            {
                _joints = new FarseerJoint[jointCapacity * 2];
            }
        }