I'm working on a game similar to Hill Climb Racing, with two wheels loosely attached to the body of a vehicle. At the moment, I'm using the Joints extension to attach the wheels to the body. It would be pretty easy to use some revolute to make the tires stick to one place relative to the body, but I'd like there to be a bit of looseness to it, like suspension.
My current solution (which is not working) involves using some invisible "anchor" actors to attach the wheels to the center of the underside of the car using revolute joints. The revolute joints have their limit angles set to the proper amounts, which apparently need to be in radians, as opposed to degrees. However, the limits seem to be ignored if any force besides gravity is applied to the tires (for example, the ground). Observe (all limits set to 12 degrees, motors disabled):
https://www.dropbox.com/s/vb4s3ps1ur7y6yg/HillClimbTest.swf?raw=1(Don't worry about the number in the top left; it's just the distance from the anchor to the front tire.)
I've experimented with a bunch of different variables, including:
- Limits set to the desired values (tires swing around very easily)
- Limits set to 12 (tires still swing around, but not as much)
- Gravity changed from 20 to 2 (tires swing around, slowly at first, then getting more and more crazy)
- Gravity set to 0 (tires swing slowly to 12 degrees)
- Enabling motors with motor speed and max torque of 500 (I can't tell the difference)
I've done a bit of research, and what I've found is that the line joint is the suggested joint to use for a tire (apparently, it was created for just this purpose). This was what I was originally intending to do; however, since there is no block to attach two actors with a line joint, I thought it was impossible.
So, my main question: Is it possible to attach two actors with a line joint? If not, I'd be happy to show my code for someone to look over. Thanks in advance!