Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Temas - jorgebes

#1
Por favor necesito ayuda, soy un poco torpe (y nuevo) programando y he hecho un script  para subir y bajar de un coche (u otro vehículo), y no va, pero no se que falla.¿ alguien podría decírmelo por favor?Es el siguiente (está en js) :var alladopuerta : boolean = false;
var conduciendo : boolean = false;
var persona : Transform;
var coche : Transform;
var puerta : Transform;
var puntosalida : Transform;
var camaracoche : Camera;
var camarapersona : Camera;
function Entrar()
        {
        if(alladopuerta){
            GetComponent.<GUIText>().text = "pulsa E para entrar";
        }
        }
function OnTriggerEnter(Player : Collider)
    {
    Debug.log("Trigger Enter");
    alladopuerta = true;
}
function OnTriggerExit(Player : Collider)
{
    Debug.log("Trigger Exit");
    alladopuerta = false;
}
function Update()
    {
    if(Input.GetbuttonDown("Use") && alladopuerta) {
        conduciendo = true;
    }
    if(conduciendo){
        persona.GameObject.SetActive(false);
        persona.GameObject.SetActive = false;
        // parent player to Exit Point
        persona.parent = puntosalida.transform;
        persona.transform.localPosition = Vector3(-1.5,0,0);
        // parent PlayerParent to car
        puntosalida.parent = coche.transform;
        puntosalida.transform.localPosition = Vector3(-0.3,1.5,-0.65); //Driverside exit point, adjust accordingly per vehicle.
        // GameObject.Find("VehicleObjectName").GetComponent("DrivingScriptHere").enabled=true;
        GameObject.Find("Car").GetComponent("CarController").enabled=true;
        GameObject.Find("Car").GetComponent("CarUserControl").enabled=true; //Enables the script component to operate Vehicle.
        camarapersona.enabled = false; //Disables the playerCamera
        camaracoche.enabled = true; //Enables the carCamera
    }else{    
        // make character visible again
  persona.GameObject.SetActive(true);
  persona.GameObject.SetActive = true;
  // unparent player from everything
  persona.transform.parent = null;
  // exitPoint.parent = doorTriggerLeft.transform;
  // parent Exit Point to car gameobject
  puntosalida.parent = coche.transform;
  // GameObject.Find("VehicleObjectName").GetComponent("DrivingScriptHere").enabled=false;
  GameObject.Find("Car").GetComponent("CarController").enabled=false; //Disables the script component to park Vehicle.
  GameObject.Find("Car").GetComponent("CarUserControl").enabled=false;
  camarapersona.enabled = true; //re-enables player camera
  camaracoche.enabled = false; //disables car camera
}
  if(Input.GetbuttonDown("Use") && conduciendo) {
        conduciendo = false; }
        }    GRACIAS por adelantado, un saludo 
http://unityspain.com/applications/core/interface/file/attachment.php?id=8413">EntrarVehiculos.js