Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class ballBehavs : MonoBehaviour {
- int i;
- Rigidbody rb_me;
- // Use this for initialization
- void Start () {
- rb_me = GetComponent<Rigidbody> ();
- }
- // Update is called once per frame
- void Update () {
- if (Input.GetKey (KeyCode.W)) {
- rb_me.AddForce (transform.forward * i * Time.deltaTime);
- i++;
- } else {
- i = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement