- Home /
Reverse Camera Twitches
Hello!
I have a reverse camera that works like this:
void FixedUpdate ()
{
if (CarTouchControls.reverseOn == true || CarTouchControls.currentSpeed < 0) {
rotationDamping = 0f;
} else {
rotationDamping = 3.0f;
}
}
When stop reversing and currentspeed hits 0, the camera twitches once to the right. How could I prevent this?
Thanks in advance!
Answer by redeemer · May 24, 2015 at 11:33 PM
Try adding an equal in the evaluation if, like this. This way, when current speeds hits 0 the damping would be 0 :
void FixedUpdate ()
{
if (CarTouchControls.reverseOn == true || CarTouchControls.currentSpeed <= 0) {
rotationDamping = 0f;
} else {
rotationDamping = 3.0f;
}
}
I tried it, but I have a fancy intro with the camera when starting the level and then the speed is obviously 0. Any other options?
You can enable the script once your intro is done or with a delay so when it start the speed is not 0 or manually set your starting speed slightly above 0, with just that info is hard to tell...
This worked. Thanks a lot! :)
void FixedUpdate ()
{
if (CarTouchControls.reverseOn == true && CarTouchControls.started || CarTouchControls.currentSpeed <= 0 && CarTouchControls.started) {
rotationDamping = 0f;
} else {
rotationDamping = 3.0f;
}
}
Your answer
Follow this Question
Related Questions
Laggy Camera 2 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers