Skip to content

Instantly share code, notes, and snippets.

@markusrt
Created September 25, 2012 19:59
Show Gist options
  • Save markusrt/3784093 to your computer and use it in GitHub Desktop.
Save markusrt/3784093 to your computer and use it in GitHub Desktop.
Platformer Controller in Air controls
var absoluteAirVelocity = Mathf.Abs(movement.inAirVelocity.x);
if (absoluteAirVelocity < movement.inAirMinSpeed)
{
movement.inAirVelocity = Vector3(Mathf.Sign(h), 0, 0)
* movement.inAirMinSpeed;
}
else if (absoluteAirVelocity > movement.inAirMaxSpeed)
{
movement.inAirVelocity = Vector3(Mathf.Sign(h), 0, 0)
* movement.inAirMaxSpeed;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment