- Home /
how to change transform.Translate speed
i want to vibrate fast the miFat object at y axis for 5 seconds and i am using the script below:
bool Up;
float timer;
void LateUpdate ()
{
if (timer <= 5) {
if (Up) {
miFat.transform.Translate (0, 0.1f, 0);
Up = false;
} else {
miFat.transform.Translate (0, -0.1f, 0);
Up = true;
}
timer += Time.deltaTime;
}
}
but i want faster vibration. If i change 0.1f to something else it changes the vibration velocity. How can i change the vibration speed?
Comment
You need to space out the movement over at least a few frames, if your FPS is high, you will literally never see the object move except maybe once or twice if you pay really close attention. I suggest doing Vector3.$$anonymous$$oveTowards or Vector3.Lerp to move from each position.