News › Forums › RAIN › Sample Projects, How To, and Code › Chasing player on navmesh
This topic contains 3 replies, has 2 voices, and was last updated by prime 7 months, 1 week ago.
December 4, 2022 at 11:01 am #34525
If I want an enemy to chase the player all over the navmesh even if the player moves behind obstacles, do I just make a Navigation Target the child of the player, and have the enemy AI always moving toward that Navigation Target?
Is there a better way to do this without using a Navigation Target and just using the player’s transform directly?
Thank youDecember 4, 2022 at 12:01 pm #34526
Sure. Do just what you said - use the player’s transform/game object directly. Variables that contain transforms/game objects are valid move targets for move nodes.
For example, when you use a sensor and enter a variable name in the Form Variable field, it’s the game object that gets bound.December 4, 2022 at 3:16 pm #34532
Can you clarify? I want the enemy to avoid obstacles.
It seems using the player’s transform directly doesn’t allow the enemy to chase the player around obstacles. I used the Move action using the player’s transform as the target and the enemy will make a beeline for the player and walk into a brick wall and keep smashing into it forever.
But if I make a Navigation Target the target, then the enemy will deftly avoid all obstacles to get to the target.December 4, 2022 at 3:27 pm #34534
Something else must be going on. For RAIN, there’s no difference between the two methods. Do you have a project you can share that demonstrates the problem? Also, are you using the very latest RAIN? (2.1.6)
You must be logged in to reply to this topic.