Determining when a character has reached a ledge?

Blitz3D Forums/Blitz3D Programming/Determining when a character has reached a ledge?

Rogue Vector(Posted 2005) [#1]
In the Tomb Raider games, when (walk) is selected, Lara will walk up to a ledge but not fall off it.

If the player has the walk function de-selected, Lara could fall off tall buildings and cliffs etc.

Does anyone have some code that will check whether the game character has reached a sheer drop? (Without using triggers)

Maybe something that uses LinePick on a dummy object that is parented to the main character.

Regards,

Rogue Vector


Diablo(Posted 2005) [#2]
dont have any code but you could just use hidden meshs like cubes, place them on the ledges and check for a collision with that cube.


Matty(Posted 2005) [#3]
If you want to use linepicks then a simple method is this:

while walk is selected, and the player begins to move in a direction (ie presses cursor key in some games) then perform a linepick at the location where the character is about to move to, straight down for a reasonable distance. If it returns '0' then no mesh has been picked meaning the player is moving towards a sheer drop. If that is the case then disallow the move.


Kalisme(Posted 2005) [#4]
one of my first (good) blitz3d things I programmed was a little bot, it pretty much used the same method Matty was talking about, but I created a second entity (pivot) and attached it to my bot... it was forced to look the same direction as my bot but when checking for floors it used "entitypick" and was pointed a little further down... it also checked not as far down for stairs and things... but anyway... Matty's idea... it's a good one :)