Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void FixedUpdate ()
- {
- horizontalMoving = Input.GetAxis("Horizontal");
- verticalMoving = Input.GetAxis("Vertical");
- Vector3 movement = new Vector3 (horizontalMoving, 0.0f, verticalMoving);
- rb.velocity = movement * speed;
- rb.position = new Vector3
- (
- Mathf.Clamp(rb.position.x, boundary.xMin, boundary.xMax),
- 0.0f,
- Mathf.Clamp(rb.position.z, boundary.zMin, boundary.zMax)
- );
- rb.rotation = Quaternion.Euler (0.0f, 0.0f, rb.velocity.x * -tilt);
- }
Advertisement
Add Comment
Please, Sign In to add comment