- Home /
Is there any way to tell a wheel collider which way gravity is without Physics.Gravity?
I have an alternate gravity system in the works, and things have been going quite swimmingly, until i tried to implement vehicles. It appears that if I change Physics.Gravity to (0, 0, 0), while still applying force to the rigidbody in the direction of gravity (0, -9.81, 0), it no longer understands how to grip the ground, and therefore does not move when I attempt to. It also slides to the side as if it were touching a surface with zero friction after it hits the ground.
I had thought perhaps there were a way to alter Physics.Gravity before and after the WheelCollider calculations for only affected objects, but there does not seem to be a way to order scripts to do it this way either.
To clarify, everything seems to work except for the wheel collider grip. The spring and damper works fine, physics reactions are correct, just no wheel friction.
Further Investigation has resulted in understanding that it doesn't seem to matter which direction a gravity value faces in Physics.Gravity, as long as its magnitude matches the currently desired gravity value.
Answer by raulius · Jan 15, 2018 at 05:56 AM
Hi, did you find a solution for this? I'm working on a car game using a custom circular gravity, and thought about asking you before approaching how to use wheel colliders over a sphere with gravity. Cheers
Answer by SamFernGamer4k · Sep 19, 2021 at 01:36 AM
This post is old, but it might help someone that comes here. Maybe the best option is to create your own wheel collider script. There are advantages, like being able to add more settings and even use curves instead of individual values.