Exemplo n.º 1
0
        public static WheelJoint CreateWheelJoint(PhysicsWorld world, Body bodyA, Body bodyB, Vector2 anchor, Vector2 axis, bool useWorldCoordinates = false)
        {
            WheelJoint joint = new WheelJoint(bodyA, bodyB, anchor, axis, useWorldCoordinates);

            world.AddJoint(joint);
            return(joint);
        }
Exemplo n.º 2
0
        public static AngleJoint CreateAngleJoint(PhysicsWorld world, Body bodyA, Body bodyB)
        {
            AngleJoint angleJoint = new AngleJoint(bodyA, bodyB);

            world.AddJoint(angleJoint);
            return(angleJoint);
        }
Exemplo n.º 3
0
        public static RopeJoint CreateRopeJoint(PhysicsWorld world, Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB, bool useWorldCoordinates = false)
        {
            RopeJoint ropeJoint = new RopeJoint(bodyA, bodyB, anchorA, anchorB, useWorldCoordinates);

            world.AddJoint(ropeJoint);
            return(ropeJoint);
        }
Exemplo n.º 4
0
        public static WeldJoint CreateWeldJoint(PhysicsWorld world, Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB, bool useWorldCoordinates = false)
        {
            WeldJoint weldJoint = new WeldJoint(bodyA, bodyB, anchorA, anchorB, useWorldCoordinates);

            world.AddJoint(weldJoint);
            return(weldJoint);
        }
Exemplo n.º 5
0
        public static FixedMouseJoint CreateFixedMouseJoint(PhysicsWorld world, Body body, Vector2 worldAnchor)
        {
            FixedMouseJoint joint = new FixedMouseJoint(body, worldAnchor);

            world.AddJoint(joint);
            return(joint);
        }
Exemplo n.º 6
0
        public static PulleyJoint CreatePulleyJoint(PhysicsWorld world, Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB, Vector2 worldAnchorA, Vector2 worldAnchorB, float ratio, bool useWorldCoordinates = false)
        {
            PulleyJoint pulleyJoint = new PulleyJoint(bodyA, bodyB, anchorA, anchorB, worldAnchorA, worldAnchorB, ratio, useWorldCoordinates);

            world.AddJoint(pulleyJoint);
            return(pulleyJoint);
        }
Exemplo n.º 7
0
        public static GearJoint CreateGearJoint(PhysicsWorld world, Body bodyA, Body bodyB, Joint jointA, Joint jointB, float ratio)
        {
            GearJoint gearJoint = new GearJoint(bodyA, bodyB, jointA, jointB, ratio);

            world.AddJoint(gearJoint);
            return(gearJoint);
        }
Exemplo n.º 8
0
        public static MotorJoint CreateMotorJoint(PhysicsWorld world, Body bodyA, Body bodyB, bool useWorldCoordinates = false)
        {
            MotorJoint joint = new MotorJoint(bodyA, bodyB, useWorldCoordinates);

            world.AddJoint(joint);
            return(joint);
        }
Exemplo n.º 9
0
        public static FrictionJoint CreateFrictionJoint(PhysicsWorld world, Body bodyA, Body bodyB, Vector2 anchor, bool useWorldCoordinates = false)
        {
            FrictionJoint frictionJoint = new FrictionJoint(bodyA, bodyB, anchor, useWorldCoordinates);

            world.AddJoint(frictionJoint);
            return(frictionJoint);
        }
Exemplo n.º 10
0
        public static DistanceJoint CreateDistanceJoint(PhysicsWorld world, Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB, bool useWorldCoordinates = false)
        {
            DistanceJoint distanceJoint = new DistanceJoint(bodyA, bodyB, anchorA, anchorB, useWorldCoordinates);

            world.AddJoint(distanceJoint);
            return(distanceJoint);
        }
Exemplo n.º 11
0
        public static RevoluteJoint CreateRevoluteJoint(PhysicsWorld world, Body bodyA, Body bodyB, Vector2 anchor)
        {
            Vector2       localanchorA = bodyA.GetLocalPoint(bodyB.GetWorldPoint(anchor));
            RevoluteJoint joint        = new RevoluteJoint(bodyA, bodyB, localanchorA, anchor);

            world.AddJoint(joint);
            return(joint);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Attaches the bodies with revolute joints.
        /// </summary>
        /// <param name="world">The world.</param>
        /// <param name="bodies">The bodies.</param>
        /// <param name="localAnchorA">The local anchor A.</param>
        /// <param name="localAnchorB">The local anchor B.</param>
        /// <param name="connectFirstAndLast">if set to <c>true</c> [connect first and last].</param>
        /// <param name="collideConnected">if set to <c>true</c> [collide connected].</param>
        public static List <RevoluteJoint> AttachBodiesWithRevoluteJoint(PhysicsWorld world, List <Body> bodies, Vector2 localAnchorA, Vector2 localAnchorB, bool connectFirstAndLast, bool collideConnected)
        {
            List <RevoluteJoint> joints = new List <RevoluteJoint>(bodies.Count + 1);

            for (int i = 1; i < bodies.Count; i++)
            {
                RevoluteJoint joint = new RevoluteJoint(bodies[i], bodies[i - 1], localAnchorA, localAnchorB);
                joint.CollideConnected = collideConnected;
                world.AddJoint(joint);
                joints.Add(joint);
            }

            if (connectFirstAndLast)
            {
                RevoluteJoint lastjoint = new RevoluteJoint(bodies[0], bodies[bodies.Count - 1], localAnchorA, localAnchorB);
                lastjoint.CollideConnected = collideConnected;
                world.AddJoint(lastjoint);
                joints.Add(lastjoint);
            }

            return(joints);
        }