- Home /
Vehicle Won't go past 2nd gear.
I'm using Andrew Gatows, Vehicle physics for a experiment i have everything running smoothly except for gear change.. The Vehicle is automatic but it won't go past 2nd Gear. My Car has Gears.. This is the shift gears part of my script.
function ShiftGears() {
// this funciton shifts the gears of the vehcile, it loops through all the gears, checking which will make
// the engine RPM fall within the desired range. The gear is then set to this "appropriate" value.
if ( EngineRPM >= MaxEngineRPM ) {
var AppropriateGear : int = CurrentGear;
for ( var i = 0; i < GearRatio.length; i ++ ) {
if ( FrontLeftWheel.rpm * GearRatio[i] < MaxEngineRPM ) {
AppropriateGear = i;
break;
}
}
CurrentGear = AppropriateGear;
}
if ( EngineRPM <= MinEngineRPM ) {
AppropriateGear = CurrentGear;
for ( var j = GearRatio.length-1; j >= 0; j -- ) {
if ( FrontLeftWheel.rpm * GearRatio[j] > MinEngineRPM ) {
AppropriateGear = j;
break;
}
}
CurrentGear = AppropriateGear;
}
}
After some tinkering i found out the problem comes from this line.
rigidbody.drag = rigidbody.velocity.magnitude / 250;
This limits the cars "Speed" but is causing issues with shifting.. Does someone know why this is? or how to resolve this issue?
EDIT: Without rigidbody.drag = rigidbody.velocity.magnitude / 250; $$anonymous$$y car is uncontrollable.
Answer by Hardik-somani · Apr 14, 2015 at 03:48 PM
i have same problem,change minEnginRPM and maxEngineRPM... change minEngineRPM=100 and maxEngineRPM=500 in both script and inspector...
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Car rolls over when turning in real-time 1 Answer
Guaranteed shot into hole from plane? 0 Answers
Make objects easier to select 1 Answer
How to 'flick' objects in a 2d game 1 Answer