I find myself in alot of situations like these and was wondering if I could code these kind of if statements more efficient?
if (velocity.x > runSpeed)
{
velocity.x = runSpeed;
}
if (velocity.x < -runSpeed)
{
velocity.x = -runSpeed;
}
if (velocity.z > runSpeed)
{
velocity.z = runSpeed;
}
if (velocity.z < -runSpeed)
{
velocity.z = -runSpeed;
}
Aucun commentaire:
Enregistrer un commentaire