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. Looking forward to your inputs. Regards.
But will it not be too complex for putting them on every edge? Leave alone AC but even for a normal small game wouldn't it be too much?
afaik for something like ac, that's how you'd do it. but then they had 140 people working on it (yeah not a real number). for a pc game, no not too complex. just a heck of a lot of work. could get to be too much for an iphone game tho. in which case you'd probably want to make your levels fairly linear. give em a couple places to make choices but limit it.
In Tomb Raider this is done using "markup", which is just another form of triggers that tell Lara where she can hang on ledges, jump on poles, etc. All that markup is carefully placed by hand, which is a monster of a job. Having said that, putting stuff in to make your game aware of ledges and other obstacles is only one part of the job. The other part (the really tough one) is implementing all jumping and hanging behaviors in your character controller.
You might just work out an editor script where that detects edges on a model and places triggers on them. It would be somewhat complex, but the pay off is that, once you have it, you can process any building model through it, saving you development time down the road.
I wound recommend creating some meta data that describes what the character can and cannot hold onto that is separate from the actual level geometry. Also you should probably pre-calculate such information as doing lots of ray casts during the main game loop will be slow. Another way could be to have a collision mesh that is a very low polygon version of your level. Then in that mesh you can mark certain polygons as different types of collision. So for example you could mark edges in that collision mesh. Performing collision detection on the low poly collision mesh is far quicker than doing so on your level geometry.
Well I have no other choice than to go the hard way for time reasons. So I am doing it through raycasts. Lets see how it goes. Will let you know on any progress. Thanks for the help guys. Unity forums rock !!!