Move platform but how?
Hey ho,
Can someone tell me how I can write a script in Unity for a platform so that it starts at x 0, y 3.8, z 0 and moves to x0, y 5.55, z 0 before returning to the catch position?
Thank you in advance for your efforts.
LG Timo
Hi.
is easy to use Vector3.Lerp(a,b,p);
a is the starting position of your platform
b is the end position of your platform
p are the percentage of vector between a and b (example: 0.5 (50%): your platform is exactly between a and b)
that could look like this:
p = 0;
void Update()
♪
transform position = Vector3.Lerp(new Vector3(0, 3.8f, 0), new Vector3(0, 5.55f, 0), p);
p += Time.deltaTime * “a factor”;
}