Unity3D Movimiento de Ruedas wheel Move

Vamos a realizar un juego para android para despues colgarlo a Play Store, bien vamos a crear un coche en Blender para despues importarlo a Unity3D

 

Aquí ya tenemos nuestra Camioneta ahora lo que vamos hacer es importarlo a nuestro Unity en FBX.

 

Una vez Exportado el Formato FBX abrimos nuestro Unity, y importamos nuestra Camioneta

Aquí tenemos nuestra camioneta y sus cuatro Ruedas que Son Cylinder,Cylinder_001,Cylinder_002,Cylinder_003, esas serian nuestras cuatro ruedas a las que vamos a cambiar de nombre

Aquí tenemos nuestras 4 ruedas, ahora vamos a crear un objeto Vació al que vamos a poner Wheel Collider,

a la rueda la incorporamos en el objeto vació le creamos otro objeto vació al que llamaremos FL y le incorporamos el Wheel Collider y deberia quedar tal cual esta en la imagen, y hacemos lo mismo las las 3 ruedas restantes

 

Aquí tenemos las 4 ruedas WheelCollider se las asignamos a nuestro  coche, ahora vamos a nuestro Camión y le asignamos el siguiente Script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(WheelCollider))]
public class pt : MonoBehaviour
{
    public WheelCollider wheelFL;
    public WheelCollider wheelFR;
    public WheelCollider wheelRL;
    public WheelCollider wheelRR;

    public Transform wheelFL_Trans;
    public Transform wheelFR_Trans;
    public Transform wheelRL_Trans;
    public Transform wheelRR_Trans;

   
    
    public float fuerza;     

    public float velocidad; 

    public float velocidadactual;

    public float angulodireccion;
    public float giro;    
    private Rigidbody rigidBody;
 
   

    void Start()
    {
        rigidBody = GetComponent<Rigidbody>();
       
    }

    void FixedUpdate()
    {
        velocidadactual = 2 * Mathf.PI * wheelFL.radius * wheelFL.rpm * 60 / 1000;
        
        {
            wheelFL.motorTorque = fuerza * Input.GetAxis("Vertical");
            wheelFR.motorTorque = fuerza * Input.GetAxis("Vertical");
            wheelRL.motorTorque = fuerza * Input.GetAxis("Vertical");
            wheelRR.motorTorque = fuerza * Input.GetAxis("Vertical");
       
        }


        velocidad = GetComponent<Rigidbody>().velocity.magnitude * 15;


        giro = angulodireccion * Input.GetAxis("Horizontal");
        wheelFL.steerAngle = giro;
        wheelFR.steerAngle = giro;

      
    }

    void Update()
    {
        wheelFL_Trans.Rotate(0, 0, wheelFL.rpm / 60 * 360 * Time.deltaTime);
        wheelFR_Trans.Rotate(0, 0, wheelFR.rpm / 60 * 360 * Time.deltaTime);
        wheelRL_Trans.Rotate(0, 0, wheelRL.rpm / 60 * 360 * Time.deltaTime);
        wheelRR_Trans.Rotate(0, 0, wheelRR.rpm / 60 * 360 * Time.deltaTime);

        Vector3 RuedaDireccion = wheelFL_Trans.localEulerAngles;
        RuedaDireccion.y = giro + 90;
        wheelFL_Trans.localEulerAngles = RuedaDireccion;
        wheelFR_Trans.localEulerAngles = RuedaDireccion;

     
    

         
    }
}

       

una vez que tengamos  hecho le asignamos las ruedas y los WheeCollider que hemos creado

Y ya lo tendríamos.

  • Related Posts

    El Real Madrid remonta a la Roma, pero sigue sin convencer: ¿tiene Vinícius los días contados?

    El Real Madrid remonta a la Roma, pero sigue sin convencer: ¿tiene Vinícius los días contados? Ayer el Real Madrid consiguió una victoria frente a la Roma en un partido…

    El Barça está por encima de Messi, señor Gaspart, pero su historia más gloriosa lleva su nombre

    JOAN GASPART a LEO MESSI Gaspart, Messi y el Barça: el club está por encima de todos, pero su historia no se puede borrar «¿Quién se ha creído? Que vaya…

    One thought on “Unity3D Movimiento de Ruedas wheel Move”

    1. Its such as you read my thoughts! You apear to know so much aproximately this, such as you wrote the e book in ite or something. y fel that you juste could do with a few percente to power the message home a litle bit, bute other than that, that is wonderful blog. a fantastic read. Il certainly be back. Damita erberte Bowles

    2. y loved as much as you wil receive performed proper ere. The caricature is tasteful, your authored material estylish. nonetheles, you comand get boughte an nervousnes over that you would lique be turning in the following. il definitely come further previously again since precisely the similar juste aboute a lote incesantly inside of case you protecte this increase. Leland Packston Veronike

    3. We are a bunch of volunteers and opening a new scheme in our community.
      Your site provided us with helpful info to work on. You’ve done an impressive task
      and our entire community will probably be thankful to you.

    Deja una respuesta

    You Missed

    El Real Madrid remonta a la Roma, pero sigue sin convencer: ¿tiene Vinícius los días contados?

    • Por admin
    • octubre 15, 2026
    • 19 views
    El Real Madrid remonta a la Roma, pero sigue sin convencer: ¿tiene Vinícius los días contados?

    El Barça está por encima de Messi, señor Gaspart, pero su historia más gloriosa lleva su nombre

    • Por admin
    • octubre 13, 2026
    • 18 views
    El Barça está por encima de Messi, señor Gaspart, pero su historia más gloriosa lleva su nombre

    Mbappé desafía al Bernabéu y Mourinho lo defiende: ¿castigo justo o caza mediática?

    • Por admin
    • octubre 10, 2026
    • 50 views
    Mbappé desafía al Bernabéu y Mourinho lo defiende: ¿castigo justo o caza mediática?
    El último baile del 10

    Criticar a Lamine por su fútbol, sí; cuestionar que sea español, no.

    • Por admin
    • octubre 5, 2026
    • 53 views
    Criticar a Lamine por su fútbol, sí; cuestionar que sea español, no.

    Cristiano y Portugal: una historia demasiado grande para terminar de esta manera

    • Por admin
    • octubre 4, 2026
    • 23 views
    Cristiano y Portugal: una historia demasiado grande para terminar de esta manera