Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class tp_controller : MonoBehaviour {
- public float speed = 10.0f;
- public float rotspeed = 10.0f;
- public static CharacterController CharacterController;
- public static tp_controller Instance;
- void Awake() {
- CharacterController = GetComponent("CharacterController") as CharacterController;
- Instance = this;
- tp_camera.UseExistingOrCreateNewMainCamera();
- }
- void Update () {
- if(Camera.main == null)
- return;
- GetLocomotionInput();
- tp_motor.Instance.UpdateMotor();
- }
- void GetLocomotionInput()
- {
- var deadzone =0.1f;
- tp_motor.Instance.MoveVector = Vector3.zero;
- if(Input.GetAxis("Vertical") > deadzone || Input.GetAxis("Vertical") < deadzone)
- tp_motor.Instance.MoveVector += new Vector3(0,0, Input.GetAxis("Vertical"));
- // I need to make a way for the input to send information to make the motor turn??
- if(Input.GetAxis("Horizontal") > deadzone || Input.GetAxis("Horizontal") < deadzone)
- tp_motor.Instance.MoveVector += new Vector3(Input.GetAxis("Horizontal"), 0,0 );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement