Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //cmd + ' / ctrl + ' Input Rigidbody
- public float speed = 1.0f;
- private int collectionCount = 0;
- void FixedUpdate()
- {
- if (Input.GetKey(KeyCode.W)) rigidbody.AddForce(Vector3.forward * speed * Time.deltaTime);
- if (Input.GetKey(KeyCode.S)) rigidbody.AddForce(-Vector3.forward * speed * Time.deltaTime);
- if (Input.GetKey(KeyCode.A)) rigidbody.AddForce(-Vector3.right * speed * Time.deltaTime);
- if (Input.GetKey(KeyCode.D)) rigidbody.AddForce(Vector3.forward * speed * Time.deltaTime);
- }
- void OnTriggerEnter(Collider other)
- {
- if (other.gameObject.tag == "PickUp")
- {
- other.gameObject.active = false;
- collectionCount += 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement