Configurable Joint : where is an additionnal force applied to the main body?

Hello everyone,

I am quite new to unity (only a few years, but solo learning… so let’s say quite new…).
I am trying to rig a vehicle, for that I am using 4 configurable joints (one for each wheel). Then I have 5 bodies : 1 box for the chassis, and 1 sphere collider per wheel.

Right now, I have a working prototype, however, something is not working properly :
When I measure a slip angle at the wheel, or a longitudinal slip, I add a force to the rigidbody of the wheel, using AddForceAtPosition(), giving it the contact patch of the tire on the ground (indeed, that is where all the loads can come from).
I get a decent behavior from the car: I even have direct effects from this type of “simulation” : the car takes a roll/pitch angle when turning/braking, because you are applying load below the position of the center of mass. However, if I try to lower the car a bit, the roll angle comes inverted (tilts to the left, when turning left), and I discovered that the exact position when it inverted was when the Center of Mass of the chassis was going below the center of the spheres used for the wheel…

This is where comes my question : where are exactly applied the forces applied on a child body (the wheel) onto the main body (the chassis), in a joint configuration ?
Because I was assuming that the force would be applied at the position where I defined it : contact patch - and in that case, I would have to lower the car below the ground to invert this roll behavior - but according to the behavior I observe, it seems to be applied by default at the center of mass of the child body…
If so, would you have any advice to change this behavior ? I have been trying for a while to solve this problem :

  • trying lots of different combinations of anchor positions
  • I even messed with the position of the sphere collider in the attached body
  • even changed the addforceAtPosition() point : I put it 1m below the contact patch position and the behavior is exactly the same for the car, just like if it did not car of that position…

I hope that my question was clear enough and I thank you in advance for any remark or advice!

[EDIT] For those coming back to this post : the solution came thanks to my discussion with Edy :
The full vertical suspension I was using (the wheel is restricted to only go up/down) was not properly defining the roll center. Basecally, as it is a perfect translation, the Instant Center of Rotation is to the infinite. It happens that with this setup, the instant center becomes ‘‘naturally’’ defined by Unity in the height of the wheel center. Basecally, in the end, I was losing lots of possibilities with this solution, when Edy’s solution enable to properly define the roll center and other anti effects.
Thanks a lot, Edy for that!

The tire forces are always applied at the tire’s contact point, regardless they’re applied to a child rigidbody or to the main rigidbody directly.

However, the situation you describe is perfectly fine. Depending on how are you setting up the joints with respect to the center of mass of the car, you may have the roll center above the center of mass, effectively causing the roll angle to work the opposite to what is typically expected. This is physically correct.

In car racing these effects are carefully considered. You can configure the geometry of the suspension (instant center / instant axis) in a way so the car turns perfectly flat or with a minimal roll angle, and even braking and accelerating while staying perfectly flat (anti-dive / anti-squat effects).

With vertical displacement only then I guess it’s up to Unity applying the joint forces to the main rigidbody. If that happens above or below the center of mass, then you have a roll direction or another.

By mere coincidence I’m currently working on kinematic suspensions in Unity :slight_smile:

https://x.com/VehiclePhysics/status/1759581185682932104 https://x.com/VehiclePhysics/status/1757047533044400199

Basically the joint makes the wheel rotate around the instant axis (which is defined by the front and side instant centers). Then the roll center can be easily configured.

Kinematic suspension 2

Hello Edy,

Thanks a lot for your answer! It looks like I just found the perfect person for my issue!

Yes Indeed, I know that the roll axis (axis between front/rear roll centers) will be the axis of rotation for the chassis. However, as I simplified a lot my kinematics (I am just using the standard character joints, with vertical displacement only authorized), I end up with an extreme case of vertical displacement only for the wheel. As a consequence, for me, I was ending up with a situation where the instant center of rotation of my wheel compared to my chassis would be in the infinite laterally, thus, the final roll center (being the intersection point of the lines linking the left-wheel instant center of rotation to the left-tire contact patch and the right-wheel instant center of rotation to the right-tire contact patch) would have ended up pretty much on the perpendicular of the trajectory of my wheel… I was assuming that if I correctly defined the wheel body, with a center of the body on the ground, I would get a roll center on the ground…

But as I am righting this down, I just realize that I tricked myself into thinking I could just forget about the car-physics I learned and just put the load at the ground, with a vertical displacement for the wheel and everything would end up being fine :slight_smile:

But now I think I can see my real problem : if I want to be able to control the roll center height, that means I need to be able to control where unity considers the wheel to be (like the wheel body center maybe?..)
So I guess my problem is where you are highlighting it : the position of the joints with respect to the center of mass.

Then, of course, if I wanted to go more realistic, I should also implement a true kinematics for my suspension, to get a proper roll center and some proper anti-lift/jack effects, but to be honest, I wanted to have the cursor arcade-simulation closer to arcade than simulation. And leave the physics for the rest of my day at work^^. So a proper joint positioning should be fine, bu how to do that exactly ?
As I mentioned, I already tried to move up and down the offset of the anchor point and it doesn’t seem to do the trick, it is like it will always go back to the center of the sphere…