Advertisement

Implementing a proper suspension movement and physics

Started by September 21, 2022 03:32 PM
9 comments, last by bmarci 2 years, 1 month ago

After spending time with built-in vehicle component in Unreal Engine (WheelHandler) and Unity3D (WheelCollider), I realized that both of them don't have proper suspension movement. The wheels only go up and down on a vertical axis, like the spring-damper is connected right on top of the wheel. But in reality, it should move on an arc, and affect the camber, based on the type of suspension (leafspring, double wishbone, strout)
In my suspension implementation, I have a WheelHub component, that stays in place within the car body, acting as a suspension-wheel system. I only use one raycast model just like how WheelHandler and WheelCollider works. The WheelHub acts as the frame of reference, then other stuffs like steering angle, camber, suspension compression, are integrated in to a virtual wheel position and rotation, using Vector3 and Quaternion maths. Then the resulting rotation and position is applied to the actual mesh. Sort of like:

public void GetWheelPose(out Quaternion rotation, out Vector3 position)
{
   // Maths here. Use wheelhub as reference frame since it doesn't move
   // For example, steering
   Quaternion upRotation = Quaternion.AngleAxis(wheelUpVector, steeringAngle);
   rotation = wheelhub.rotation * upRotation;
   // wheel position based on suspension compression
   position = wheelhub.position + wheelhub.up * suspensionCompression;
}

Then the wheel mesh receives the about result to set its position and rotation (world coordinate)

GetWheelPose(out wheelMesh.rotation, out wheelMesh.position);


So my questions are:

1- When the wheel moves along an arc, it also changes its sideway position a bit, does the tire on the wheel experience slip/scrubbing and wear out over time? Assuming the tire is very sticky and will not move/slide sideway, when the wheel is at a point in the arc, how would the car body react to the force the tire is generating to hold it it place? Well, is that suspension movement correct at all in real life?
2 - What would be the Vector3 and Quaternion maths to calculate the position and rotation of the wheel based on the suspension travel? I don't want to use methods in Transform like Transform.RotateAround(), and only wants to use Quaternion and Vector3. Currently I need a rotation around a virtual axis, like the image below, then how can I do that using Quaternion math?

Thank you very much for your help. I'm sorry if I'm being hard to understand. English is not my first language, but I will try my best to explain myself.

Images taken from Unreal Documentation. They're not the mose accurate, but conveys the idea.

Vu Chi Thien said:
1- When the wheel moves along an arc, it also changes its sideway position a bit, does the tire on the wheel experience slip/scrubbing and wear out over time? Assuming the tire is very sticky and will not move/slide sideway, when the wheel is at a point in the arc, how would the car body react to the force the tire is generating to hold it it place? Well, is that suspension movement correct at all in real life?

Hello, the tire scrub should end up in lateral force, so as your suspension moves the wheel pushes the car sideways. Also there is an effect called “lateral jacking” when the lateral force is transferred through the suspension links and pushes the chassis up/down.

In general I also use vertical spring damper, but I use the swing arm length to “rotate” the wheel and get the sideway offset, also the camber/toe change is a preset value scaled by the suspension movement, so vertical spring is quite OK if you add the extra.

In general this effect is not that noticeable. For me the lateral-jacking and anti-pitch suspension “geometry” gained much more control over drivability.


Regarding the math, I simplified the problem so the wheel can only travel inwards (which is not 100% correct)
something like this:

angle = atan(suspension_delta_x / suspension_arm_length);
scrub = (1 - cos(angle)) * suspension_arm_length;

The suspension_delta_x is the suspension change from the rest position (rest position == the deflection when the car is standing on the ground)
So the equation above assumes that the arm is horizontal in rest pose.



Advertisement

@Vu Chi Thien

Vu Chi Thien said:

1- When the wheel moves along an arc, it also changes its sideway position a bit, does the tire on the wheel experience slip/scrubbing and wear out over time? Assuming the tire is very sticky and will not move/slide sideway, when the wheel is at a point in the arc, how would the car body react to the force the tire is generating to hold it it place? Well, is that suspension movement correct at all in real life?

I think this question is better directed at someone who designs suspension systems, as it's more complex than in your animations. This is just my experience from working on cars. I'm not an expert.

Keep in mind that the upper and lower A-arms are often different lengths, so the tire doesn't necessarily move in an arc like in the animation, and stay perfectly vertical. The A-arms also may not be parallel to each other. Finally the sidewall of tires can flex. Note that suspensions with less travel tend to have tires with lower aspect ratios and vise versa.

@Gnollrunner @bmarci Thanks you guys so much for your contribution.
In my model I calculated using spring length rather than delta from rest pose, so I think I have to modify mine. Overall I think I will go with the simple route. I won't be calculating the extra physics that comes with the wheel, and the movement will entirely be visual only.
I was thinking about adding the wheel lateral movement from suspension compression to the overal contact velocity, into the slip calculation, but I think that's too much hassle and can produce unexpected behaviors. The trade-off is not worth it in my opinion.
1 - Another thing about suspension is dependent suspension (leaf spring, etc). Since both wheels are connected to a fixed rod, how movement of one wheel can affect the other?

2 - This one is still about suspension geometry, but not the spring-damper part, but about steering. I've read on steering axis inclination, where steering axis would be inclined to reduce scrub radius to ideally 0. However, this makes me think about non zero incline, because that would mean the wheel is rotated not around its center, but a pivot off to the inside of the car, like image below (made with paint, sorry for the quality). Is that how real life steering works? And if so, how would the displacement of the wheel when affect the overall physics (changing camber, tire force)?
First image, red line is the wheel center pivot, green is the assumed steering axis.
Second image, the black shape is the wheel, and the circle is the path the wheel will travel if the steering axis is offset

Gnollrunner said:
Keep in mind that the upper and lower A-arms are often different lengths, so the tire doesn't necessarily move in an arc like in the animation, and stay perfectly vertical. The A-arms also may not be parallel to each other.

You are totally right, but we are talking about videogames here ?
A few years ago I spent some time on figuring out the wheel/suspension movement only from attachment points.
The only problem was: where those attachment points should be?
Unless you have blueprints or have a ferrari where you can measure, you can only guess.
Tweaking 6 coordinates per wheel to achieve the intended result is somehow cumbersome, and after all the whole calculation results in hub movement, camber/toe in change as it moves.
And by itself it will not work out unless the rest of the simulation also deals with such level of accuracy.
So I reverted back to simple vertical movement, with pre-set dynamic camber change and tire scrub ?

Vu Chi Thien said:
1 - Another thing about suspension is dependent suspension (leaf spring, etc). Since both wheels are connected to a fixed rod, how movement of one wheel can affect the other?

The leaf-spring is a funny thing, as the front side is fixed, but the other end is attached on a swing arm, so the axle in the middle can move forward/backward thus the whole axle is rotating. Search for roll-steer and bump-steer ?

Vu Chi Thien said:
2 - This one is still about suspension geometry, but not the spring-damper part, but about steering. I've read on steering axis inclination, where steering axis would be inclined to reduce scrub radius

Not sure if you think about this, but it's similar to what gokarts have. Then again that has an other purpose, to jack the front due to fixed rear axle.

@bmarci So for dependent suspension, compression of one side can affect the one on the other side as well? Say the left one got pushed up and the right one will be pushed down?

Also about leaf spring, can it be independent and not connected to an axle? Say in FWD cars, the rear axle doesn't need to have the wheels attached together, since they don't need power. Then each wheel has its own leaf spring.

Advertisement

This is fascinating. Any code that you can spare?

taby said:

This is fascinating. Any code that you can spare?

Yes. I'll keep this topic updated with what've found and what've done code wise.

Vu Chi Thien said:
So for dependent suspension, compression of one side can affect the one on the other side as well? Say the left one got pushed up and the right one will be pushed down?

This is a kind of “sub-optimal” situation that we want to avoid. This is what anti-rollbars are used for ? So pushing one side down will push the other down as well.

Vu Chi Thien said:
Also about leaf spring, can it be independent and not connected to an axle? Say in FWD cars, the rear axle doesn't need to have the wheels attached together, since they don't need power. Then each wheel has its own leaf spring.

I've seen pictures/drawings of it, but not in real vehicles. The suspension itself looked much more complicated than a single connected axle.

taby said:

This is fascinating. Any code that you can spare?

If you are fancy about sim coding, you'll find some material here: http://racer.nl
Sources

This topic is closed to new replies.

Advertisement