I’m looking to get some NPCs to roam around and area, communicate (wave) with eachother, and interact with objects in particular places. Navmeshing would be the perfect tool, if it wasn’t for the fact that they will be on a moving landscape (AR)! Does anyone have any ideas or tips on how I can go about programming this behaviour? I’m quite experienced in programming and Unity development so don’t hold back!
Very interesting problem. Yeah, NavMesh is probably not an option, and it that’s the case, you’ll have to roll your own.
The LOE for doing so is primarily dependent on the complexity of your moving terrain. If there’s a lot of inclines/declines and/or un-navicable terrain, you’ll probably have to use invisible colliders or triggers to block it off from the chars (i.e. basic obstacle avoidance, not hard to code but could be a big time sink). If the terrain isn’t that complex, you can probably use a well-tweaked ragdoll setup with appropriate root motion settings to get the characters to moving around the terrain at an appropriate height. You may not need the individual colliders and/or rigidbodies of the ragdoll, but collisions could look better with them. So, colliders and rigidbodies for obstacle avoidance and interaction.
Last would be directional navigation. Controlling the character rotation and velocity. You could do this in FixedUpdate (if using a non-kinematic Rigidbody on the character), or in OnAnimatorMove and LateUpdate (if using a kinematic Rigidbody). Unity has pretty good example code for controlling animation and movement velocity here. The example also uses a NavMesh, but you can see from the code that character rotation and positioning can be completely controlled through code, while at the same time synching animation speed with character velocity.