Sign in to follow this  
abhi_shekv

Edge Detection in 3D

Recommended Posts

Hi Guys, Just wanted an idea as to how we can implement edge detection in a game. Something like Assassin's Creed where the character holds on to the edge of a wall or something thereby hanging. Any pointers? One way I thought of doing it is through a raycast of detecting if something is there in the vicinity or not and if not, then we can assume that we are standing at the edge. Another way could be triggers. Looking forward to your inputs. Regards.

Share this post


Link to post
Share on other sites
you could cast say 4 rays down from the player...sort of in a a square shape. If there's a huge change in the distance to the floor for any ray, you know you're at an edge.

Share this post


Link to post
Share on other sites
If you want the character to be able to hang from edges, maybe you should pre-define which edges are 'hangable' in your level editor or equivalent? Perhaps a single invisible quad that defines the hangable area, say the top surface of a window ledge, and another larger one at the same height, parallel to the ground plane, that extends out into the air - if your character passes through the larger one (falling or jumping), then he should grab hold of and hang from the smaller one. Though that does mean you'd have to do this for every edge you want your character to grab.

EDIT: Yeah, triggers, like you said :) D'oh!

Share this post


Link to post
Share on other sites
I don't think raycasting is the way to go here. You'll want to check the nearby area for ledges, not a certain direction. Try doing some collision checks with a box or sphere that surrounds the player, against the level geometry. For every polygons/objects that match, check if there's a grabbable ledge (either defined by a level-designer, by an automated tool or checked at run-time - probably using criteria such as the angle between that polygon and surrounding ones, and the orientation of the faces involved).

Share this post


Link to post
Share on other sites

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