Jump to content
  • Advertisement
Sign in to follow this  
sinnelius

algorythm to detect nearest edge on object from players

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

I frequent things like unreal, and unity.

I have this problem that i need to solve, 

in which a character, standing near either a vertical plane or a small railing, which supposed to part of the arena,

will detect edges/planes nearest to it.

The character does not need to be facing these points of interest,

as long as they are within a certain proximity to it.

the priority is of course, the character's angle of view.

My problem so far is because vertical plane is part of larger structure, an arch or maybe a giant rocks with girdles on it.
Or since the railing is a long piece of surface, it is hard to take the nearest point on the edge of the railing to be marked.
Either i am thinking it wrong, or there's a formula to solve this.


I hope to discuss this rather than a straight answer.

Share this post


Link to post
Share on other sites
Advertisement

I am assuming that you want to detect the vertical planes around your arena for collision detection? If not can you give me some more details?

 

If so normally, you will find this in Unreal and Unity, you will create a collision mesh around your object (rock, chair etc.) that is a lot simple in complexity compared to the object within it. For example, the collision mesh could be a cube but the object within it is a chair. This is because it is simpler and easier to test for a collision vs the simple collision mesh then the object mesh.

 

As for which one of these meshes is closest to your character, you could do this a number of ways. The most straightforward, but by far not the most efficient, is to test if there has been a collision between each mesh vs the character (just a for loop). You could extend this to a radius around your character too, get a vector length between your character and the target object. For improved methods to do this, you could do a K-D Tree/Octree for example but this would require more work to get set up but on the long run would a way to go.

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!