First of all, ODE joints are attached to 2 bodies or to 1 body and "space."
Joints can't be joined to another joint, so you may have to have an "extra"
body or two between the cars.
It seems you already have a little familiarity with joints. I've never
joined multiple joints in the way you've described, but it appears you want
the second car to be able to move relative to the first car with 3 degrees
of freedom - 1) rotate about (for instance) a fixed vertical axis of the
first car (swinging around like a sling), 2) rotate about the second car's
axis which points from the second car to the first car, and 3) move linearly
closer to and away from the first car.
One approach may be to join the first car to an intermediate body with a
piston oriented vertically to the first car. That would allow the
intermediate body to rotate about the vertical axis. Maintain the
intermediate body's position relative to the first car by fixing the
intermediate body's position before each timestep, to prevent it from moving
vertically.
Join the intermediate body to the second car with a piston (rather than a
slider). The second piston will allow the second car to rotate about one of
its own axes *and* to move toward and away from the intermediate body (and
the first car).
Once the intermediate body and second car are joined by a piston, you can
monitor the relative positions of those two bodies with
dJointGetPistonPosition(pistonJointID). Apply a "restoring" force to the
second car along the piston's axis proportional to that position to simulate
the spring force. That is, force-on-second-car = -k*position.
Alternatively, join the intermediate body to the first car with a Hinge2,
permitting the intermediate body to both rotation about the vertical axis
(Axis1) and rotate about a horizontal axis (Axis2.) Join the intermediate
body to the second car with a slider and monitor the slider position to
simulate a spring as described above.
Bruce
> --
>
> You received this message because you are subscribed to the Google Groups
> "ode-users" group.
> To post to this group, send email to
ode-...@googlegroups.com.
> To unsubscribe from this group, send email to
>
ode-users+...@googlegroups.com.
> For more options, visit this group at
>
http://groups.google.com/group/ode-users?hl=en.
>
>
>
>