This project is read-only.

About Joints

Dec 7, 2012 at 8:01 AM
Edited Dec 7, 2012 at 8:02 AM

Hi, I tested Physics Helper XAML and it works great. I have some comments about Joints.

1. It looks like that only WeldJoint, DistanceJoint, RevoluteJoint and AngleJoint are supported in the project (see AddPhysicsJoint function in PhysicsCanvas.cs) 

2. When a joint is created there is no control over it.

3. It seems that the properties IsWeldJoint, IsDistanceJoint, AngleSpringEnabled, AngleLowerLimit, AngleUpperLimit, AngleSpringContant (see PhysicsJoint class) are only there to solve custom problems (Demo.Simple and Demo.Advanced)

Suggestions

1. The PhysicsJoint class and AddPhysicsJoint function  should be rewritten so that they are independent of the joint type (maybe they should work only with the abstract FarseerPhysics.Dynamics.Joints.Joint class )

2. The end user to have access to the created joint through  PhysicsJoint class.

Dec 7, 2012 at 11:27 AM

These are good suggestions.

For what it's worth, you can access all of the Farseer properties, including Joints, through the PhysicsCanvas.Simulator object - which exposes the Farseer World.

For example, the code below iterates through all of the Farseer Joints and disables motors:

// disable motors && angle joints

foreach (Joint joint in cnvGame.Simulator.JointList)

{

    if (joint is RevoluteJoint && (joint as RevoluteJoint).MotorSpeed != 0)

    {

        (joint as RevoluteJoint).MotorEnabled = false;

        (joint as RevoluteJoint).MotorTorque = 0f;

    }

    if (joint is PrismaticJoint && (joint as PrismaticJoint).MotorSpeed != 0)

    {

        (joint as PrismaticJoint).MotorEnabled = false;

    }

}