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 - zopas tv

#1
General (Antiguo) / problemas con online
Noviembre 15, 2017, 07:53:29 PM
hola a todos, estoy aprendiendo a hacer un juego en red (para saber aplicarlo a otros proyectos) pero tengo varios problemas:
 
1- He utilizado el siguiente codigo para hacer el movimiento online pero ahora en el juego, al ejecutarlo no se mueve el coche (A todo esto,¿tengo que poner el "NetworkBehaviour" y "using UnityEngine.Networking" en todos los script que quiero que funcionen online?)
 

using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
public class movimiento : NetworkBehaviour {

public float VelocidadNormal = 15f;
public GameObject nitro;
// Use this for initialization
void Start () {
   
      
}

// Update is called once per frame
void Update () {
   if (!isLocalPlayer) {
      return;
   }
   float tecladoVertical = Input.GetAxisRaw ("Vertical");
   float posicionZ = transform.position.z + (tecladoVertical * VelocidadNormal * Time.deltaTime);
   transform.position = new Vector3 (transform.position.x, transform.position.y, posicionZ);
   float tecladoHorizontal = Input.GetAxisRaw ("Horizontal");
   float posicionX = transform.position.x + (tecladoHorizontal * VelocidadNormal * Time.deltaTime);
   transform.position = new Vector3 (posicionX, transform.position.y, transform.position.z);
   Nitro ();
   }
 public void Nitro () {
   if (Input.GetButton("Fire1")) {
      VelocidadNormal = 30f;
 
   }      
   if (Input.GetButtonUp ("Fire1")) {
      VelocidadNormal = 10f;
   }
}
}

 
2- al intentar probar el juego en red con build and run me da una serie de errores y no se que esta ocurriendo
 



   
       
   
   
      (1-Failed to find prefab parent for scene object [name:coche]
      UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
   
   
      2-Failed to find prefab parent for scene object [name:coche]
      UnityEngine.Networking.NetworkIdentity:OnValidate()
   
   
      3-Failed to find prefab parent for scene object [name:coche]
      Unit***itor.BuildPlayerWindow:BuildPlayerAndRun()
   
   
      4-Error building Player: Failed to find prefab parent for scene object [name:coche]
   
   
      5-Unit***itor.BuildPlayerWindow+BuildMethodException: 2 errors
        at Unit***itor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x00207] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:172 
        at Unit***itor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83 
      Unit***itor.BuildPlayerWindow:BuildPlayerAndRun()
   
   
      6-Failed to find prefab parent for scene object [name:coche]
      UnityEngine.Networking.NetworkIdentity:OnValidate()  ) 
   
   
       
   

[/quote]
 
me podrian decir que significan?? 
 
Gracias
#2
General (Antiguo) / Puntuacion, gol
Noviembre 07, 2017, 08:33:24 PM
estoy intentando hacer un script de puntuacion, y en verdad lo he condeguido, pero es muy simple y da lugar a errores.
 
El script es este:
 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class puntuacion : MonoBehaviour {
public static int azul = 0;
public Text Azul;
// Use this for initialization
void Start () {
   Azul.text = "Azul: " + puntuacion.azul;
}

void OnTriggerEnter(){
   puntuacion.azul++;
   Azul.text = "Azul: " + puntuacion.azul;
}
}

 
claro, al ser abierto para todos, hasta el coche puede sumar puntuacion.
 
¿Es posible hacer que solo la pelota sume puntos???
 
es que he buscado en internet y en el manual de unity pero no encuentro nada.
 
Gracias
#3
General (Antiguo) / problema con script de nitro
Octubre 26, 2017, 04:17:24 PM
hola buenas a todos!!!
 
Mi problema es que llevo ya varios dias intentando hacer que se incremente la velocidad del coche (lo he hecho pero seguir leyendo) pero le he asignado el boton Fire1 para incrementarla pero no funciona. 
 
por aqui dejo el script
 

if (Input.GetButtonDown ("Fire1")) {
      VelocidadNormal = 30f;
 
   }      
// esta parte es para que deje de correr
   if (Input.GetButtonDown ("Fire2")) {
      VelocidadNormal = 10f;
   }

 
 
#4
General (Antiguo) / Problemas con coches
Octubre 22, 2017, 01:26:05 PM
Hola a todos de nuevo. Tengo 2 problemas:
 
El primero es que he creado un script de salto el cual funciona aparentemente bien, pero al saltar la cámara que sigue al coche se va quedando cada vez mas arriba(no vuelve a la posicion donde se encuentra el coche)
 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class salto : MonoBehaviour {
public float Salto = 10f;
// Use this for initialization
void Start () {
   
}

// Update is called once per frame
void Update () {
   float tecladoJump = Input.GetAxisRaw ("Jump");
   float AlturaSalto = transform.position.y + (tecladoJump * Salto * Time.deltaTime);
   transform.position = new Vector3 (transform.position.x, AlturaSalto, transform.position.z);
}
}

 
 El segundo es que el coche al colisionar con lo que sea se da la vuelta o se mueve hacia los lados... 
 
querria hacer que eso que eso desapareciese y siempre que colisione este intacto.
 
Muchas gracias por estar ahí !!! 
 
 
#5
General (Antiguo) / ayuda con script de movimiento
Octubre 10, 2017, 03:52:38 PM
muy buenas de nuevo, no me pasaba por aqui ya que no tenia ningun problema hasta ahora. El caso es que tengo un script de movimiento creado pero para sorpresa, al iniciar el proyecto el coche se buguea llendo para los lados y no para. 
 
¿me podeis ayudar?
 

using UnityEngine;
using System.Collections;
public class movimiento2 : MonoBehaviour {
public float Velocidad = 10f;
public    Rigidbody rig;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
   float tecladoVertical = Input.GetAxisRaw ("Vertical");
   float PosZ = transform.position.z + (tecladoVertical * Velocidad * Time.deltaTime);
   transform.position = new Vector3 (PosZ, transform.position.y, transform.position.x );
}
}

 
 
#6
General (Antiguo) / problema con script de reseteo
Septiembre 30, 2017, 03:46:08 PM
Hola!! tengo un problema ya  que al resetear las posiciones de 2 gameobjects (Barra y pelota) la pelota se va haciendo cada vez mas grande y al colocarse en la barra( transform.SetParent(Barra) ) se pone como plana. me podrian ayudar ?? Gracias. 
 

public void Reset(){
   
   transform.position = PosicionInicial;
 
   DetenerMovimiento();
}
void DetenerMovimiento(){
   
   enJuego = false;
   transform.SetParent(Barra);
   rig.isKinematic = true;
   rig.velocity = Vector3.zero;
}
#7
General (Antiguo) / ayuda con proyecto
Septiembre 23, 2017, 01:51:59 PM
hola muy buenas, estoy buscando a alguien que me enseñe programacion, entonces se me ha ocurrido una idea,podriamos hacer un fps de guerra moderna ( como la guerra de siria) con lo que a medida que avancemos con el proyecto me vais enseñando lo basico de programacion. espero a vuestra respuesta. 
#8
General (Antiguo) / ayuda con script de movimiento(C#)
Septiembre 12, 2017, 10:45:33 AM
Hola a todos, me he decantado por crear un shooter zombie en tercera persona, he creado un game object como personaje y tiene animaciones y de todo, pero al ponerle el script de movimiento, solo va hacia delante, no puede rotar ni ir hacia ningun lado que no sea adelante. La idea es que siga al cursor para rotar y que ande con las teclas "w,a,s,d" o con las flechas, pero que ande en todas direcciones.
 
Aqui dejo el script:
 

using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
    public float speed = 6f;            // The speed that the player will move at.
    Vector3 movement;                   // The vector to store the direction of the player's movement.
    Animator anim;                      // Reference to the animator component.
    Rigidbody playerRigidbody;          // Reference to the player's rigidbody.
    int floorMask;                      // A layer mask so that a ray can be cast just at gameobjects on the floor layer.
    float camRayLength = 100f;          // The length of the ray from the camera into the scene.
    void Awake ()
    {
        // Create a layer mask for the floor layer.
        floorMask = LayerMask.GetMask ("Floor");
        // Set up references.
        anim = GetComponent <Animator> ();
        playerRigidbody = GetComponent <Rigidbody> ();
    }
 
    void FixedUpdate ()
    {
        // Store the input axes.
        float h = Input.GetAxisRaw ("Horizontal");
        float v = Input.GetAxisRaw ("Vertical");
        // Move the player around the scene.
        Move (h, v);
        // Turn the player to face the mouse cursor.
        Turning ();
        // Animate the player.
        Animating (h, v);
    }
    void Move (float h, float v)
    {
        // Set the movement vector based on the axis input.
        movement.Set (h, 0f, v);
       
        // Normalise the movement vector and make it proportional to the speed per second.
        movement = movement.normalized * speed * Time.deltaTime;
        // Move the player to it's current position plus the movement.
        playerRigidbody.MovePosition (transform.position + movement);
    }
    void Turning ()
    {
        // Create a ray from the mouse cursor on screen in the direction of the camera.
        Ray camRay = Camera.main.ScreenPointToRay (Input.mousePosition);
        // Create a RaycastHit variable to store information about what was hit by the ray.
        RaycastHit floorHit;
        // Perform the raycast and if it hits something on the floor layer...
        if(Physics.Raycast (camRay, out floorHit, camRayLength, floorMask))
        {
            // Create a vector from the player to the point on the floor the raycast from the mouse hit.
            Vector3 playerToMouse = floorHit.point - transform.position;
            // Ensure the vector is entirely along the floor plane.
            playerToMouse.y = 0f;
            // Create a quaternion (rotation) based on looking down the vector from the player to the mouse.
            Quaternion newRotation = Quaternion.LookRotation (playerToMouse);
            // Set the player's rotation to this new rotation.
            playerRigidbody.MoveRotation (newRotation);
        }
    }
    void Animating (float h, float v)
    {
        // Create a boolean that is true if either of the input axes is non-zero.
        bool walking = h != 0f || v != 0f;
        // Tell the animator whether or not the player is walking.
        anim.SetBool ("IsWalking", walking);
    }
}
#9
General (Antiguo) / Saludos a todos
Septiembre 12, 2017, 09:22:39 AM
Muy buenas, estoy empezando con esto de unity
 
 
#10
Muy buenas, estoy empezando con esto de unity y quiero crear un fps sencillo, pero la verdad es que tengo muchos problemas y quiero que, si pueden, me los resuelvan. mi problema es que no puedo usar ningun script de disparo y recarga porque no funcionan. me podrian ayudar en eso?? gracias