Cita de: ACarranza date=1436292204coloca aca tus scripts para irte orientarte, es la manera correcta, saludos , y a lo que dices, ocupas un colaborador de proyecto.Si a la pregunta ocupas un colaborador de proyecto es que si tengo alguien trabajando con migo la respuesa es no, Yo solo estoy trabajando en el proyecto.
Los scripts son los siguientes.
Controles personaje:
using UnityEngine;
using System.Collections;
public class Controls : MonoBehaviour {
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
float moveDel = 0;
if (Input.GetKey (KeyCode.D)) {
moveDel = 10;
}
if (Input.GetKey (KeyCode.A)) {
moveDel = -10;
}
float moveLat = 0;
if (Input.GetKey (KeyCode.W)) {
moveLat = 10;
}
if (Input.GetKey (KeyCode.S)) {
moveLat = -10;
}
Vector3 movement = new Vector3 (moveDel, 0.0f, moveLat);
rb.AddForce (movement * speed);
}
}
Rotacion camara:
using UnityEngine;
using System.Collections;
public class Camrot : MonoBehaviour {
public float giroLaterall = -30f;
public float giroLateralr = 30f;
public KeyCode rl = KeyCode.LeftArrow;
public KeyCode ra = KeyCode.RightArrow;
void Update () {
if (Input.GetKey (rl))
{
transform.Rotate (new Vector3 (0.0f, giroLaterall,0.0f));
if (Input.GetKey (ra))
{
transform.Rotate (new Vector3 (0.0f, giroLateralr,0.0f));
}
}
}
}
Script para que la camara siga al jugador:
using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour {
public GameObject player;
private Vector3 offset;
void Start ()
{
offset = transform.position - player.transform.position;
}
void LateUpdate ()
{
transform.position = player.transform.position + offset;
}
}