Advertisement
WPDeveloper

WHat?

Jan 15th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ballBehavs : MonoBehaviour {
  5.  
  6.     int i;
  7.     Rigidbody rb_me;
  8.  
  9.     // Use this for initialization
  10.     void Start () {
  11.         rb_me = GetComponent<Rigidbody> ();
  12.    
  13.     }
  14.    
  15.     // Update is called once per frame
  16.     void Update () {
  17.  
  18.         if (Input.GetKey (KeyCode.W)) {
  19.             rb_me.AddForce (transform.forward * i * Time.deltaTime);
  20.             i++;
  21.         } else {
  22.             i = 0;
  23.         }
  24.        
  25.    
  26.     }
  27.  
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement