Hey outthere
We found a lot of script who rotate a door or something by pressing a key during a time.
Our problem is now to write a script who lift up our car in a few seconds (smooth animation).
ex. Press “K” and the car lift up 50cm over the ground in 2-3 seconds (during this time it goes upwards.
At the moment the script lift the car 5cm on each Key-Press.
Best Regards from Switzerland
MischiMusch12
P.S. The script at the moment:
function Update () {
var translation : float = Time.deltaTime * 45;
var duration : float = 1.0;
if (transform.localPosition.y > 0.16)
{
if (Input.GetKeyDown ("f"))
{
transform.localPosition = Vector3(transform.localPosition.x * 1,transform.localPosition.y - 0.2, transform.localPosition.z * 1);
}
}
if (transform.localPosition.y < 1.15)
{
if (Input.GetKeyDown ("g"))
{
transform.localPosition = Vector3(transform.localPosition.x * 1,transform.localPosition.y + 0.2, transform.localPosition.z * 1);
}
}
}