zankor
1
Hello, player is going over the ground as you can see in the video below. I want to make that the player can move only on the ground. Im using raycast and moveTowards for movement right now. thank you in advance for your help
problem here: unity3d problem - YouTube
script here: Screenshot by Lightshot
system
2
Alright! @zankor, you need a waypoint system! What you are going to do is basically set up a connection with every single grid cell you have. Say you start at a grid cell and want to get to a grid cell on the other side of the map. You will set that other grid cell as your destination and ask the controller script for a path that gets you there. It will take your current position, check the nearby grid cells, and if they move closer to the object, they add themselves to the path. This continues until you reach the destination. Then the controller sends you a list of waypoints (grid cells) you have to travel across before you get to the destination. That will ensure they stay on the ground. My suggestion, look up the A* Pathfinding Design Pattern. This will give you an in-depth overview of creating a smart AI to transverse this type of terrain. Here’s a good video describing it: A* Pathfinding (E01: algorithm explanation) - YouTube. Best of luck to you! If you have anymore questions, feel free to comment.