Forum Discussion
5 Replies
- PigeonNo12Partner
Currently, Horizon Core doesn't have an API to change the collision layer during runtime. What is the specific scenario? Asking because depending on what it is, there might be other alternatives.
- flarbPartner
I've got this issue where I have objects pathing behind the player--essentially following behind the player. When the player collides with a certain object, I set those pathing objects to path to the object the player collided with. But the problem is, these followers seem to collide with the player and stop (they are nav agents)--since the player is in-between the followers and the destination. I'm trying to switch their collision layer when this happens so they pass through the player on their way to the target.
The navigation system is kind of tricky--maye it's not a collision issue, but the nav agents seem to give up way too easily when the path to a location isn't a straight line.
- PigeonNo12Partner
Thanks for the additional information.
NavMesh has a large number of configurations and options and finding the right combination that work for X mechanic can be tricky. From what you describe, having issues following a straight line, try adjusting the "Required Forward Alignment" in both the properties of the agent npc, and in the script. If you used the scripts from the demo world, I believe the scripts in there make this parameter very narrow, preventing the agent from turning and bypass objects; remove the use of this property from the scripts if needed.
Another property to check is Stopping Distance, if the objects are closer than the value specified in this property (also check if the value is overwritten in the script), then the agents will not get any closer to the target.
- flarbPartner
Is this forward alignment property modifiable at runtime?
- PigeonNo12Partner
Yes, it's requiredForwardAlignment, a HorizonProperty under NavMeshAgent