# Increasing vehicle realism when turning

This topic is 382 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey guys,

We are working on a project that revolves around driving different types of vehicles. We have already created a basic driving mechanism that works very well, but one of the problems we are having is that the vehicles are obviously rotating around their middle (or more precisely, around their center of mass) which doesn't look too realistic. Moving the center of mass towards the front of the vehicle gave a bit better result, but it makes the vehicles more unstable on frontal collisions  and bouncing when encountering terrain unevenness.

Our goal is to have the front wheels turn first and "pull" the rest of the car behind them.

We are not using wheel colliders, rather one rigidbody (attached to the body of the car) to which we add forces and torque.

The code itself is pretty simple, it calculates the turn vector with regards to car mass, user input and some other parameters that we added to each vehicle to differentiate them, and then add torque to the car rigidbody with regards to that vector.

My question is, have you encountered this problem, and what would be your suggestion on solving it?

Thanks

##### Share on other sites

Have you tried changing where you apply the force to the rigid body?  If your turning force is applied towards the front of the vehicle, you might get the results you like without changing the center of mass.

Another option might be to have two rigid bodies that are connected, and add the torque to the rigid body that is the front.

Edited by ferrous

##### Share on other sites

How realistic do you want to go? In a typical sim, you'd apply 4 forces at the 4 wheel locations, and because these locations are offset from the centre of mass, this also creates 4 torques.

##### Share on other sites
18 hours ago, ferrous said:

Have you tried changing where you apply the force to the rigid body?  If your turning force is applied towards the front of the vehicle, you might get the results you like without changing the center of mass.

I'm using AddTorque to turn the car, and that function does not have a positional option (torque is applied around the provided axis). I'll try switching to AddForceAtPosition, and see what happens.

13 hours ago, Hodgman said:

How realistic do you want to go? In a typical sim, you'd apply 4 forces at the 4 wheel locations, and because these locations are offset from the centre of mass, this also creates 4 torques.

This part is a bit tricky to explain - we would like the driving itself to be as realistic as possible (obviously, we are making a game, not a simulation, so some concessions will be made to speed the development up), however our vehicles have the ability to "fly" (not like airplanes, but they need unrealistic maneuvering capabilities when airborne), so the behavior of the vehicle differs when grounded and airborne.

We have mechanism in place that determine if the car is grounded or not, but they are not perfect (for instance how to differentiate between the flight we want to control, and a simple bump on the road), so that causes some problems.

I've tried switching from one "main" rigidbody to main+4 wheel rigidbodies, but it causes the vehicle to go crazy on every little bump (it gets too shaky, and very hard to stabilize, even with anti roll code implemented).

The most obvious problem that I want to solve with this is the following scenario:

- if the vehicle is close to the wall or any other type of fixed obstacle and I try to turn to the opposite side, the back of the car moves towards the wall and causes a collision that pushes the vehicle back to the wall. In reality, the front wheels would pull the car, without the back of the car going the opposite way

Do you have any suggestion that might help me with that problem?

1. 1
Rutin
45
2. 2
3. 3
4. 4
5. 5

• 10
• 28
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633408
• Total Posts
3011701
• ### Who's Online (See full list)

There are no registered users currently online

×