Регистрация | Вход
using System.Collections;using System.Collections.Generic;using UnityEngine;public class LbBrakeWheel : MonoBehaviour { public float m_curMotor = 0.0f; public float m_curTorque = 0.0f; public float m_curRpm = 0.0f; void Start () { WheelCollider wheel = gameObject.GetComponent<WheelCollider>(); wheel.motorTorque = 0; wheel.brakeTorque = 0; } void FixedUpdate() { WheelCollider wheel = gameObject.GetComponent<WheelCollider>(); m_curRpm = wheel.rpm; if( m_curRpm < 0 ) { wheel.motorTorque = 0;// wheel.brakeTorque = 10; // лыжник if( m_curRpm <= 100 ) wheel.motorTorque += m_curRpm/1000; wheel.brakeTorque = 0; } else { if( m_curRpm <= 100 ) wheel.motorTorque += m_curRpm/1000; wheel.brakeTorque = 0; } }}
//Еслиm_curRpm <= 100//то в любом случаеwheel.motorTorque += m_curRpm/1000//!!!wheel.brakeTorque = 0;
//а Еслиm_curRpm < 0