Need ideas how to implement ability to swim.

138 views
Skip to first unread message

naempir...@gmail.com

unread,
Mar 9, 2021, 7:37:40 AM3/9/21
to recastnavigation
Hi, maybe someone can give me some ideas, how can be implemented swimming with detour. Basically i have two layers of geometry - upper is water, lower is ground. and some objects between them. 

The only way, that i have in my head now - is to generate additional layers between water and ground and connect them with offmesh connections, but maybe there is better alternatives?
Thanks for answers and ideas!

Paul S

unread,
Mar 9, 2021, 9:21:25 AM3/9/21
to recastna...@googlegroups.com
I have been thinking about that a lot actually.  I want that in my MMORPG and I'm hoping for some nice suggestions too.  I have mobs that can walk on the ground, of course, and I also have ones that can walk on the water surface (like water elementals) but I have not yet added fish, sharks, sea creatures, etc, because I've not been able to come up with a solution I'm happy with yet.

All I've come up with so far is to set any triangles that are below a water plane to a different area and basically have the water mob navigate on the terrain below the water BUT keep track of an elevation between the terrain and the water surface.  So, if a shark is attacking a player, for example, he navigates to the player's XZ on the ocean floor but the server will also have the shark rise or sink to the player's Y position as it moves.  If it's random movement within the body of water, you could just pick a random target Y location.  You don't have to worry about it crawling on islands because their triangles would be set to the normal ground area.

There are a couple issues with this approach, hence, why I haven't implemented it myself yet.  This means that the ocean floor/lake floor/river floor can't be jagged or steep.  Even though the mob is swimming above it, the floor actually has to be navigable.  The other issue is a minor one.  There is more complexity in handling vertical movement.  Think about Y movement only or an XZ change that is small but a large Y difference causing the mob to rise or fall too quickly, unless you code to handle those situations.

Paul


--

---
You received this message because you are subscribed to the Google Groups "recastnavigation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to recastnavigati...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/recastnavigation/35922680-ceae-41ca-b184-793bcfdb02afn%40googlegroups.com.

PaulS

unread,
Mar 9, 2021, 9:33:35 AM3/9/21
to recastnavigation
Of course, my idea (above) also assumes you have normal terrains that have no overhangs and stuff like that.  The mob would also be able to travel right through a pier unless you put enough pillars below it so that nothing can get a path on the ground going right through the pier because we have to remember, detour thinks the creature is crawling on the ground instead of being at its actual elevation.
Reply all
Reply to author
Forward
0 new messages