- Home /
How to move to specific point with character controller
I'm using Playmaker to allow players to click a point on a terrain and move to that point. However, I'm currently just moving the character to that position. This means that if the terrain isn't completely flat, the character clips through the ground.
How can I move the character to a set point on the terrain using a character controller?
Answer by Ed unity · Feb 19, 2014 at 07:24 PM
So long as the terrain does not change during runtime, you could bake a Navmesh to the terrain and then make the object a Navagent. You then give it a destination and it will navigate the terrain with the optimal path to that destination. It will also follow the terrain so it will move up and down as the terrain does.
This will probably be the fastest and most efficient way to get your object to follow the terrain, but you could also just call CharacterController.Move() to have it move towards the destination and still collide with the terrain. Although this will cause problems if the object cannot get up a steep ledge.
Thank you. Navmeshes were the solution. Never used them before.
Your answer
Follow this Question
Related Questions
Click to move a character in a terrain 1 Answer
Click to move around obstacles 2 Answers
Character Controller moves forever after colliding with object 1 Answer
Continuously rotate a gameobject on 1 axis perpendicularly to another gameobject's normal? 1 Answer
CharacterController.Move called on inactive controller 0 Answers