Hey guys me again. I am making a first person tower defense game. I have everything setup accept theres one problem; I have a path witch is pretty much a brown cube zig-zagging across the map. I would like to make a object move from the starting point to the end point of the map(And rotate accordingly, For exsample, if the path turnes). I thought about just using a animation and animating the position but it would be kinda wonky and i would like to add towers that slow/daze the enemy so that wouldnt work out to well. Any ideas?
I may have an other solution for you :
-
Create a gameobject that contain all “Checkpoint” from the begin of the enmies spawn to the end of the map (For a cube, you’ll have 1 at the beginning, 2 for the cube and 1 at the end). This gameobject contain all checkpoints in an array
Like :List m_paths = new List();
-
When you instantiate a new enemy, it gets the path saved in the scene. Then you use the method “MoveTo” with the coordinate of the first point.
-
When you reach the point, you go to the next one.
-
Remember to use a circle around the point. If you don’t the enemy may just try to reach the exact point and bug at the same position.
Hope it helps you.
I hate to say you need to learn code… Sooo I wont. All you need to do is use the cinemachine. Under the cinemachine menu panel pick create a track. Then what ever object you want to move add a cart component to it. Assign the track to the cart. Then add points to your track and move them around to make your desired path. And on the cart option you can set the objects position on the track and the speed. And what do you know, no code needed. But learning calculus will make these things muchhhh more easier to the point where you’d be able to make your own waypoint system. So don’t try to avoid learning code and math if you want to go far in this hobby/job/playground.