Hi! I´m super new to scripting and that stuff but I´m trying to get better at it by searching for tutorials and that so I can learn how to make stuff work!
What I want help with, and I have tried to make it my selfe first without succes, is to make an object move up and down wen triggered! I know how to fix the trigger, the problem is how to fix the object move up and down like an elevator!
I don´t want it to be controll based, I want it to be aoutomatic and always move up and down wen triggered… I´ve tryed using > < ( wen its < 0 it goes up and wen its > 10 it goes down for example) in different if statements but failed and wen I´ve searched for it I´ve got the wrong kind of results… If a noob could get some help?
Oh, btw. I´ve read wile searching the forums for help that the player clip through the moving objects! If so how can I fix that problem?
I know I´m basicly asking for a finished script but I need to learn some how and if I can´t find my awnser I gues this is how it has to be done… :s
Ok, so i found this and it works! I can stand on it and all that… Now I just want/need to know how to make it go back to the original position and back up again and so on!
Some sort of if statement? Add another variable? I tried some but no real progress…
var target : Transform;
var smooth = 0.5;
function Update () {
transform.position = Vector3.Lerp (transform.position, target.position, Time.deltaTime * smooth);
}
All that needs to be done is add in the trigger than its good to go! And that I know how to do! XD (Add another if statement under the if(lol == true))