Advertisement
WPDeveloper

Solved

Jan 15th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class PlayerController : MonoBehaviour {
  5.  
  6.     private Rigidbody rb;
  7.  
  8.     public int points;
  9.  
  10.     public float speed;
  11.  
  12.     void Start() {
  13.    
  14.         rb = GetComponent<Rigidbody> ();
  15.    
  16.     }
  17.  
  18.     void update (){
  19.     add_force();
  20.     }
  21.  
  22.     void FixedUpdate() {
  23.         check_input();
  24.     }
  25.  
  26.  
  27.     void add_force(){
  28.         Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
  29.         rb.AddForce (movement * speed);
  30.     }
  31.  
  32.     void check_input(){
  33.         float moveHorizontal = Input.GetAxis ("Horizontal");
  34.         float moveVertical = Input.GetAxis ("Vertical");
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement