Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Example : MonoBehaviour
- {
- public RigidBody body;
- public Vector3 velocity;
- private bool _moveForward;
- private void Update()
- {
- _moveForward = Input.GetKey("W");
- }
- private void FixedUpdate()
- {
- if(_moveForward)
- {
- body.velocity = velocity;
- }
- //Else just let the object slow down on its own using the drag.
- }
- }
Add Comment
Please, Sign In to add comment