i not want some thing to go infinalty fast , so i figure there must be a way to check either verlosity or something to limit the total force that addForce will apply over time.
can some one tell me the check that is used.
i not want some thing to go infinalty fast , so i figure there must be a way to check either verlosity or something to limit the total force that addForce will apply over time.
can some one tell me the check that is used.
when you add force use mathf.clamp
you just do
instead of
velocity = forceadded;
velocity = mathf.clamp(forceadded, min, max);
where min is the lowest acceptable value for force added and max is the highest
that will keep you from adding a huge amount of speed
if you want to limit velocity period
if(object.transform.velocity > highest_speed_ill_allow)
{
object.transform.velocity = highest_speed;
}
the moment if goes over it’ll get kicked back to max
With this you don’t change the value of addForce, but you will only disable to addForce in your addForce. It is not the perfect answer, but it works for me.
if(rgb.velocity.x < 80)
{
rgb.AddForce(transform.right * 20);
Debug.Log(rgb.velocity.x);
}