- Home /
Bike falls while turning after reaching max torque
Okay so after heck of a day, im finally able to drive the bike, not pretty realistic but it is moving at least :P , here comes the issue
1) Even if the motor is as minimum as 1000, the bike falls down on sudden turning on either direction
2) if the torque is decreased, it won't effect anyway, and the bike will fall again.
3) if i try to lower to speed then turn, it will slightly tilt to that direction but will be leaning forward as the tyres are still in contact with terrain.
4) Any help regarding the controller so i can make it super realistic?
void mainBikeMovement(){
float motor = maxMotorTorque * Input.GetAxis ("Vertical");
float Steering = maxSteeringAngle * Input.GetAxis ("Horizontal");
foreach (TiresDetails td in Tires) {
if (td.steering == true) {
td.WheelCollider.steerAngle = Steering;
}
if (td.motor == true) {
td.WheelCollider.motorTorque = motor;
}
applyLocalPositionToVocals (td);
}
}
void applyLocalPositionToVocals(TiresDetails td){
td.WheelMesh.transform.Rotate (Vector3.right, Time.deltaTime * td.WheelCollider.rpm * 10, Space.Self); //to learn
}
This is what happens if i turn the bike slowy
However if i turn without any delay, the bike will fall down after taking a complete circle.
I learnt the script via unity's learning session and it was for a car, so may be that is my issue, any help will be appreciated.