This project is read-only.

Creating a trailer

Sep 2, 2008 at 1:50 PM
Hi again in my game i have tried to create a trailer that runs after my car.

I added a Hinge joint and set values to it. But i cant get the desired effect, when i connect it to my car it looks a little strange and i want the lenght of the hinge to be longer.
So it looks like an actula trailer. i have used these values for testing i dont know if i figured them out wrong.

            float haldWidth = 0.2f;
            float sidewaysSlack = 0.5f;
            float damping = .52f;

            Vector3 hingeVec = player.GetCar.PhysicsBody.Position - BodyToConnect.Position;

            player.dragHook = new HingeJoint();
            player.dragHook.Initialise(
                 player.GetCar.PhysicsBody,
                 BodyToConnect,
                 hingeVec, // is normalized in this function
                 new Vector3(0.0f, 0.1f, 0.0f),
                 haldWidth,
                 35.0f,
                 35.0f,
                 3.0f * sidewaysSlack,
                 damping);

            player.dragHook.EnableHinge();

// i want the trailer to be able to turn 35 degrees in each direction, and i would like the hingeVec to be larger doesnt look like a hinge currently only looks like  a
static trailer with no life at all.