ironbane / IronbaneServerLegacy

A 3D MMO written using pure javascript.
http://www.ironbane.com/
GNU General Public License v3.0
175 stars 44 forks source link

Walk-to-edge motion modifier #433

Open msouth opened 10 years ago

msouth commented 10 years ago

I played the old Tomb Raider series, and I think I remember a feature where you could hold down a modifier and it would not walk off of a platform. You could just walk to an edge and it would stop when you were on the verge of falling off even if you were indicating to keep going in that direction.

It would be nice, say, when you are on a box trying to kill with underpowered/under-ranged weapons, to walk right to the edge of the box without falling off.

It would make parkour less frustrating, as well, because right now you can't tell by looking if you can take another step without falling or not.

You could do this with an extra modifier key, or incorporate it into shift. I don't know how the physics works but the logic would be something like this

on move {
    if shift_held_down {
        //'test move' the character in the indicated direction. 
        // See if falling or sliding would commence
        // if so, don't move them, jump out of this 
    } 
    //from here on, do what you always did on move
    ...
}
nickjanssen commented 10 years ago

Nice idea! Might indeed be useful and it would not require additional complex UI or keybindings, like you said we can use the existing shift key to incorporate this functionality :)

I guess we would need to cast a ray in the velocity vector direction and check downwards, if the slope is bigger than 45 degrees. Or if nothing is hit (=cliff)