Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class ControlJugador : MonoBehaviour {
- private Rigidbody rb;
- public float velocidad;
- public GameObject referencia;
- void Start () {
- rb = GetComponent<Rigidbody> ();
- }
- void FixedUpdate () {
- float horizontal = Input.GetAxis ("Horizontal");
- float vertical = Input.GetAxis ("Vertical");
- rb.AddForce (vertical * referencia.transform.forward * velocidad);
- rb.AddForce (horizontal * referencia.transform.right * velocidad);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment