- Home /
The question is answered, right answer was accepted, https://forum.unity.com/threads/wheel-colliders-and-continuous-ground-hit.1032079/#post-6685156
Wheel colliders and continuous ground hit
I have a problem with continuously detecting a ground hit from a wheel collider. I am creating splashing effects where a car drives into a puddle, and the water stirs up (using the custom render texture, I am drawing a point where the car hits the texture and using a wave equation I spread it into a ripple).
When the car drives slowly the wave follows where the tire has been, however when the car drives fast enough, artefacts start to appear - the ground hit is not continuous, leaving a few ripples here and there which is not what I want.
Is there a way to deal with this? Right now I am drawing a line between two hit points, but I would like to know if there is a better solution.
The shortened code:
void Update()
{
if (wheelCollider.GetGroundHit(out WheelHit hit))
{
//contact point is created if wheel hits the road
if (hit.collider.gameObject.layer == roadLayer)
{
Vector3 hitPoint = hit.point + (car.velocity * (Time.deltaTime));
//... create ripple at this position...
}
}
}
Follow this Question
Related Questions
Different game speed 2 Answers
why unity official course use Time.deltaTime inside FixedUpdate 2 Answers
Why is my game running different on build? 2 Answers
Invoke a method for exactly 2 seconds to move a rigidbody 1 Answer
Rigidbody and Time.deltaTime 2 Answers