Sign in to follow this  

Querying neighbors by ray casting

This topic is 396 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

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

This topic is 396 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this