maxvollmer / Half-Life-VR

VR mod for Half-Life
https://www.halflifevr.de/
246 stars 23 forks source link

Half-Life Alyx Style Ladder Mechanic. #46

Open TylerJaacks opened 1 year ago

TylerJaacks commented 1 year ago

I would like to be able to teleported to the top of ladders instead of having to use the stick or manually climb. Thanks

maxvollmer commented 1 year ago

The teleporter already works with ladders, see here: https://github.com/maxvollmer/Half-Life-VR/blob/main/src/dlls/VRControllerTeleporter.cpp#L333

You can simply point at the ladder and it will teleport you to that point. On a long ladder you can teleport multiple times to reach your intended destination, which should be good enough for a mod like this.

Automagically detecting where the "top" or "bottom" of a ladder is isn't trivial due to how ladders are implemented in Half-Life. Years ago I actually originally added that exact behavior, but it was prone to game breaking bugs. Some ladders would teleport you into a ceiling or through the floor for example. There are also ladders that extend far above or below the platforms that players need to reach, or ladders that extend over multiple floors and platforms. You would need the teleporter to stop at these platforms instead of simply the extends of the ladder. There is no trivial way of detecting these situations in code, as you would need to heuristically analyze the map geometry near each ladder.

Feel free to create a PR with improved teleporter support for ladders, if you feel confident to do so, but this is not something I will be working on in the forseeable future.

TylerJaacks commented 1 year ago

oh ok thanks maybe this is all i need.