Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class PlayerController : MonoBehaviour {
- private Rigidbody rb;
- public int points;
- public float speed;
- void Start() {
- rb = GetComponent<Rigidbody> ();
- }
- void update (){
- add_force();
- }
- void FixedUpdate() {
- check_input();
- }
- void add_force(){
- Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
- rb.AddForce (movement * speed);
- }
- void check_input(){
- float moveHorizontal = Input.GetAxis ("Horizontal");
- float moveVertical = Input.GetAxis ("Vertical");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement