- Home /
How to move something from point A to point B?
Hello, I'm pretty new at Unity and I've made a forest with a basic first person character and I have a light that has a halo on and I wanted to make that in the far far distance moving across the sky like a plane or helicoper.
All I'm trying to figure out is how to have it start moving when the game starts.
I'm sure you probably think I'm trolling because this is the stupidest question ever, but I really need to know
O$$anonymous$$ starting here is a great way to familiarize yourself with Unity and how to get all basic functionality up and going pretty quick. You can even follow along and experiment it for yourself to see what you would need to make the game you want. http://unity3d.com/learn/tutorials/modules
After that point where you finish the tutorial and still have questions on what to do, then come back to the forums.
Answer by ryan123321 · Jul 31, 2013 at 04:11 PM
Add this to your light If you have any questions let me know and can I see your game when it is done?
pragma strict
ar moveSpeed : int = 5; var Way : boolean = true; var waitTime : int = 5;
function Update () {
if (Way == true){
MoveFoward ();
}
if (Way == false){
MoveBack ();
}
}
function MoveFoward (){
transform.Translate(Vector3.forward moveSpeed Time.deltaTime);
yield WaitForSeconds (waitTime);
Way = false;
}
function MoveBack (){
transform.Translate(Vector3.back moveSpeed Time.deltaTime);
yield WaitForSeconds (waitTime);
Way = true;
}
Your answer
