- Home /
Question by
r_chevallier · Aug 07, 2015 at 12:06 PM ·
velocitybouncefalling
Check Velocity and stop Velocity so Object does not bounce.
Hello,
The below code is suppose to stop velocity in a falling gameObject so it does not bounce. It only works about 80% of the time. Any ideas how to fix it or an alternative solution. I also use this code to trigger a 'Round' coroutine and I need it to be 100% reliable.
void FixedUpdate () {
var currentVelocity = GetComponent<Rigidbody>().velocity;
if (currentVelocity.y <= 0f)
return;
currentVelocity.y = 0f;
GetComponent<Rigidbody>().velocity = currentVelocity;
StartCoroutine(Round());
}
Comment