- Home /
This question was
closed Feb 18, 2019 at 01:17 AM by
el-mas-pro-470.
Question by
el-mas-pro-470 · Feb 18, 2019 at 01:16 AM ·
script.not workingcarwheelcolliderwheel collider
My car simplicity do not work..
Hello! I did a script for a car and before it worked well, now I do not know what happened and it just does not start, it does not turn or anything, what happened? help! Thank you
using UnityEngine;
using System.Collections;
public class Auto : MonoBehaviour {
public WheelCollider ColliderDI;
public WheelCollider ColliderDD;
public WheelCollider ColliderTI;
public WheelCollider ColliderTD;
public int Aceleracion;
private float DesAceleracion;
public GameObject LucesDeFreno;
void Start ()
{
transform.rigidbody.centerOfMass = new Vector3(0,0,0);
}
void FixedUpdated ()
{
//Aceleracion de el auto
float torque = Aceleracion;
ColliderDI.motorTorque = Input.GetAxis("Vertical") * torque;
ColliderDD.motorTorque = Input.GetAxis("Vertical") * torque;
//Girar las ruedas de el auto
ColliderDI.steerAngle = 15 * Input.GetAxis("Horizontal");
ColliderDD.steerAngle = 15 * Input.GetAxis("Horizontal");
}
}
Comment
Follow this Question
Related Questions
Best way to make wheels freely turn / swivel? (Like a shopping cart) 2 Answers
Wheel collider bounce backward 1 Answer
Wheel setup - Rotating hub to steer but not forward 0 Answers
Door Script compiler error 0 Answers
Applying Torque to wheelcollider 1 Answer