Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

Querying neighbors by ray casting

This topic is 609 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, In one particular case, I use regular octree to query neighbors, which exhibits no problems.

In another, as I want to save computer resources on computations and all that stuff,

I changed to an irregular octree, the pathfinder does find the destination,

But the ray cast was a bit off-track. Because When I do a ray in a direction of (1,0,0),

which normally hits the EAST node somehow, now not hitting anything,

which then resorts to hitting a SOUTHEAST node.

 

As a result, the agent will travel in a diagonal move, but sometimes go thru walls.

Are there anyways I can prevent the agent going thru walls, as a SOUTHEAST cast does work,

since the EAST nodes are in different shapes?

 

Thanks

Jack

Edited by lucky6969b

Share this post


Link to post
Share on other sites
Advertisement

I am not sure how you are doing this but the idea would be to first ray cast against the root node (whatever shape that may be), if it hits then you cast against any objects contained with in and store any hits. You then cast against any child nodes, the shape of those shouldn't matter as long as you can ray cast against it. If you hit any then you ray cast against any objects in those. You then ray cast against the child nodes of those and so on until you you run out of nodes to check. You then will have a list of objects that were hit (if any) and you just select the closest one.

 

There are some opportunities for optimisation there, firstly if the ray always originates in the root node then you don't need to do that check. You could probably do something with culling siblings if you have already found a hit that is closer than another sibling could provide.

 

If you are missing nodes out then I would think there's an issue with your ray-volume check and you should check there especially as you are merging some of those siblings which could throw up some difficulties

 

When you do your checks do you have it hard coded that (1, 0, 0) would go east and have the east node already selected rather than going down the tree in turn? 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!