Skip to content

Instantly share code, notes, and snippets.

@sugi-cho
Last active December 18, 2015 02:39
Show Gist options
  • Save sugi-cho/5712318 to your computer and use it in GitHub Desktop.
Save sugi-cho/5712318 to your computer and use it in GitHub Desktop.
velocity = Vector3.ClampMagnitude(velocity, speedScale * controller.globalSpeed);
Quaternion rotation = Quaternion.FromToRotation(transform.forward, velocity);
transform.rotation = Quaternion.RotateTowards(Quaternion.identity, rotation, controller.globalYawSpeed * yawScale * Time.deltaTime) * transform.rotation;
transform.position += transform.forward * velocity.magnitude * Time.deltaTime;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment