Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void FixedUpdate()
- {
- if(isLocalPlayer == false) return // Don't try to move the player
- // if this isn't running on the local player object
- // Remove unwanted forces resulting from collisions
- body.velocity = Vector3.zero;
- body.angularVelocity = Vector3.zero;
- // Handle rotation
- var rot = body.rotation.eulerAngles;
- rot.y += hInput * rotationSpeed * Time.deltaTime;
- body.MoveRotation(Quaternion.Euler(rot));
- // Handle forward movement
- body.MovePosition(body.position + vInput * trans.forward * 5f * Time.deltaTime);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement