YiMingFu / recastnavigation

Automatically exported from code.google.com/p/recastnavigation
zlib License
0 stars 0 forks source link

Off-mesh links with userdata #138

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi Mikko,

I am looking to use the off-mesh links; I think you'd previously mentioned that 
off-mesh links can store userdata - in my case this would be a ptr to a game 
object (e.g. door, vaultable object). I can't see how to do this...perhaps I'm 
overlooking something obvious?

Thanks,
- Neil

Original issue reported on code.google.com by armstron...@gmail.com on 1 Nov 2010 at 12:52

GoogleCodeExporter commented 8 years ago
I think I have only dreamed about that feature :) It can be added, though.

The data needs to be in format which can be stored on disk, so it cannot be a 
pointer, but I can add unsigned int there.

The way I dreamed that the data would be accessible is that you would pass an 
ID to the navmesh builder and later you could query that ID (or maybe a pointer 
to dtOffMeshConnection which contains it) based on dtPolyRef. Normally you 
access that  ID once just before you start using it so that extra indirection 
should not kill perf.

--mikko

Original comment by memono...@gmail.com on 1 Nov 2010 at 1:14

GoogleCodeExporter commented 8 years ago
I was thinking of piggy-backing on the dePolyFlags...use them as an ID instead 
of ability flags. So, for example, if the Area type is "Door"...I know the 
PolyFlags are an ID lookup instead of "Walk", "Swim" etc.

Does that sound reasonable? It means that no extra data needs to be added to 
Recast. I just need a custom dtQueryFilter to deal with the different 
interpretations of PolyFlags.

Original comment by armstron...@gmail.com on 1 Nov 2010 at 2:08

GoogleCodeExporter commented 8 years ago
Hi, I added userId for off-mesh connections in R252. If you detect an off-mesh 
connection polygon, you can query its' data using: 
getOffMeshConnectionByRef(ref), and there is userId value you can use in the 
returned dtOffMeshConnection.

I will consider your idea of having kind of "userId" per polygon, which allows 
you to interpret it as you please in the query filter. Feel free to add an 
issue about it so that I won't forget it.

Original comment by memono...@gmail.com on 7 Nov 2010 at 3:32

GoogleCodeExporter commented 8 years ago

Original comment by memono...@gmail.com on 21 Nov 2010 at 2:54