Wheel Collider questions.

I recently posted another similar thread, but I though that that thread was becoming confusing for other people to read, hence no replies.

So, I’m starting another to better detail my question(s).

Suspension related questions:

1.) For the suspensionSpring, does the suspensionDistance start from the center of the wheel and go downward the local y axix?

2.) Also, related to the suspensionDistance, does the suspensionSpring.suspensionTarget affect in which direction the spring force applied? The docs say a value of 1 means the spring is fully extended (when at rest), whic means to me is that the spring is pushing downward the local y axis (or resisting becoming compressed). What is the case for when the value is 0?

3.) I assume that if my assumptions in question one is correct, then when the suspensionSpring.targetPosition == 1 then the location of the wheel collider (the wheel collider would actually move, right?) would be wheelPosition.y - suspensionDistance.

4.) Is it possible to determine the position of wheel under the suspension spring forces (like in Yoggy’s car demo)? If so, any clue on how to?

WheelFrictionCurve related questions:

5.) What does each value of the friction curve actually mean? I’ve search the forum for wheel collider and wheel friction curve info, and in every thread I’ve found, everyone has been confused about how to use the WheelFrictionCurve properly. I think a better explanation is needed.

6.) This question might not be needed to be answered if question 5 is answered well, as I could probably figure it out. How can skidding be simulated in sharp turns (sidewaysFriction)? Or how can spinouts be simulated (forwardFriction). I’m guessing these are two in the same, so either work for me :smile:

I know I posed a lot of questions, and I hope you guys don’t mind answering them. It just seems a lot of people are confused about WheelColliders. Hopefully the suspensionSpring questions will be a bit easier to answer :slight_smile:

I’ve got a decent car simulation that’s robust enough that it can work similar to Yoggy’s demo and the OTEE Car demo, but it’s these last few things that are disabling me from making it to par, so I’d really appreciate the help!
Thanks a lot!
Jedd

I am by no means an expert on this, but I did play with wheel colliders for a bit.

The way I understand it, the circle in the wheel collider is just for visual reference, and that stick coming out of it is the important bit. The Suspension Target is a point along that stick that will intersect the “ground” when the springy action has taken its course. “1” is the far end of the stick, “0” is the beginning. You can set that zero point to be inside the circle, if you want the edge of the circle to “sink” into the “ground”.

I’m sure somebody with a more complete understanding will be able to elaborate on this, but hopefully this helps you visualize it a bit better. The documentation didn’t provide what I found to be a clear explanation.

Thanks Jessy.

Bump. I really think a better explanation of how wheel colliders works in general (my questions probably cover the most confusing parts of it). I’ve talked to many people about the wheel colliders, and nobody has a clue how they work…

Aras, Joachim, weren’t you guys the ones to created the race demo and wheel collider, respectively? Any info/help?!

Well, I’ve almost figured out how to fake the the graphical part of the wheel suspension. This is how I do it:

if( wheelCollider.isGrounded )
		{
			wheelCollider.GetGroundHit(out hit);
			
			float hitdis = Vector3.Distance(transform.position, hit.point);
			Vector3 newPos = transform.position + (down * (hitdis - wheelCollider.radius));
			Vector3 localNewPos = transform.InverseTransformPoint( newPos );
			localNewPos.y = Mathf.Clamp( localNewPos.y, -wheelCollider.suspensionDistance, transform.localPosition.y );
			graphicalWheel.localPosition = localNewPos;
		}
		else
		{	
			graphicalWheel.position = wheelCollider.transform.position + (down * (wheelCollider.suspensionDistance*wheelCollider.suspensionSpring.targetPosition));
			
		}

But, the problem is, is that there is no “in-between” for y position. For instance, if you go over a bump, the wheel stays fully compressed. I think the problem is that when a wheel is on the ground, this value:
Vector3 newPos = transform.position + (down * (hitdis - wheelCollider.radius));would make the wheel go above the car if I didn’t clamp it. It needs to take in to account the force of spring instead of going fully compressed. Hopefully that makes sense. Basically, in the air the wheels should be fully uncompressed. When the car might land on the ground from a tall height the wheels should become fully compressed, then spring back a little trying to reach it’s target position. When going over a bump, the wheel should compress more, but not all the way (like when the falling from the air) because the force isn’t big enough, then try to spring back to its target position (like before).

Can anyone help take in account for the force of the spring to get this realistic affect? I know that the spring does actually affect the car realistically (like I just described), but how can I get the wheels to react realistically also?

Thanks!