Advertisement
Kogamma

Movement code

May 28th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. void FixedUpdate()
  2. {
  3. rigidbody.velocity -= new Vector3(velocityLastFrame.x, 0f, velocityLastFrame.z);
  4.  
  5. rigidbody.AddForce(new Vector3(dir.x, 0f, dir.z));
  6. rigidbody.AddForce(new Vector3(strafeDir.x, 0f, strafeDir.z));
  7.  
  8. Vector3 velocityLastFrame = rigidbody.velocity;
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement