Skip to content

Instantly share code, notes, and snippets.

@5outh
Created July 11, 2012 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 5outh/3094378 to your computer and use it in GitHub Desktop.
Save 5outh/3094378 to your computer and use it in GitHub Desktop.
Update
if(Input.GetKey("w")){
xDisplacement = Mathf.Sin(Mathf.Deg2Rad * transform.eulerAngles.y);
zDisplacement = Mathf.Cos(Mathf.Deg2Rad * transform.eulerAngles.y);
displacement = Vector3(xDisplacement, 0, zDisplacement) * forwardSpeed * Time.deltaTime;
transform.position += displacement;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment