- Home /
How do you turn an empty game object into a NavMeshAgent target?
Hey, I want to use an Empty Gameobject, which is attached to my player as a child, as a destination for my NavMeshAgent, how do I do that? There are many scripts, which convert the transform data of a prefab into the destination. But these do not work for me. Because even if the GameObject is directly at the player, the agent doesn't want to go there. He just walks to the point 0/0/0. At this point, my prefab out of my assets, is positioned.
Answer by privatecontractor · Jan 19 at 08:44 PM
Hi @EinfachFinn ,
belive that you have some issue with hierarchy in your scene. Try this one:
(Parent) GameObject "Your Designated name" - will help you to change character into prefab in future.
》(Child # 1) GameObject "Main" - here attache all scripts (AI Controler, Movement Controler, etc...) , and components ( NaveMesh)
》》(Child of Child #1) GameObject "Model" - inside drop your model/mesh...
》(Child #2) GameObject "Target" - this will be GameObject/Transform you need to assign as target for NavMeah.
Hope its enough, if you will have any issues with code, let me know will try to help.
Your answer
Follow this Question
Related Questions
How To Stop Movement With RigidBody.AddForce 2 Answers
The vision of a camera (displayed as a 3D Cone) needs to rotate towards the player 1 Answer
Enemy should follow the Player if he is in range, but how? 2 Answers
What is the Input Key for the Steam Vive triggers? 1 Answer
object reference not set to an instance of an object 1 Answer