- Home /
Make car CenterOfMass change dynamically
Can some one give me directions to start a dynamically script to change the center of mass, like car simulation, in real life if you are ate like 20 km/h and max turn it will only skid because the velocity doesn't changed to much the center of mass, but if you turn at like 120km with max turning value the center of mass will likely get all to the opposite side that you have turned and will make the car roll a lot until the air resistence stop the velocity and the center of mass return to where it was idle.
I don't want a complexe physic script made by someone, i just want a direction to go, a logic to change the center of mass on the go dynamically.
If you did want to change the centre of mass (which you don't) you could use another rigidbody with appropriate joints.
will make the car roll a lot until the air resistence stop the velocity
I'm sorry for off-top, but that's not how it works.
Answer by hav_ngs_ru · Jun 30, 2014 at 06:04 AM
actually, the center of mass stays where it was. The inertia and the friction of the wheels causes the car to turnover. And the suspension elasticity make the car off the ground (to roll a lot in air).
So I see some ways to make what you want:
the first is to use a physics materials for wheels (to make a grip enough to make car turnover instead of just drift) and a spring joints between body and wheels to make a car "jump". without scripts.
the second - is to make a car just a box (with no wheels) and use anisotropic friction setting of physics material (to make a car slide toward and to cling the ground when moving sideways). it would be enough to make car turnover. If you wish to make it off the ground - you may add a force in script (depends on angle between velocity vector and the forward vector of the car body).
hum, so i missed the point and you have clarified the path for me, really thanks, i forgot about spring joints, so wheel collider springs stay where they are?