How do context sensitive actions work? It seems like they could go very wrong pretty easily.

A context-sensitive action is an action that can only occur under a specific conditions. In order to allow them to be used, we need to detect that those conditions have been met. If all conditions are satisfied, we can offer the player the option of performing the action.

Simon Pegg vaulting over a fenceALT

Imagine we’re trying to add a fairly common context-sensitive action - vaulting over a waist-high wall and landing on our feet on the other side - to our game. In order to do this, we need a vaulting-into-landing animation and a way to detect a vaultable waist-high wall. What kind of conditions would need to be met in order to allow the player to vault over the wall? Here are some conditions that I think we would need to meet:

Jafar has a long listALT
  • We cannot vault over a wall and land on ground that is a different height than what we started from or the animation won’t work (clip through the floor or land on thin air)
  • We can only vault over a waist-high wall that is exactly waist-height so that the animation does not clip through or float above the top of the wall
  • We cannot play the landing animation if there isn’t enough ground on the other side of the wall for our feet to land on (no vaulting over a cliff or into another piece of geometry)
  • We cannot vault over the wall if the wall isn’t thick enough for our character model to place hands on it as part of the vault
  • We may have to adjust the character model’s position and orientation in order to ensure the correct approach angle and starting location
  • We shouldn’t move the player too far or it will look really weird, so we need to restrict the player to certain facing angles and distances
Kevin Hart is not tall enough to rideALT

This list of requirements sets specific limits of where in our levels we can place these vaultable walls. We can’t put them in places where these conditions cannot be met, which means that we need a certain amount of clearance and open space around each vaultable wall. This effectively standardizes contextual actions within the level environment - the level designer can only place vaultable walls in areas that meet these conditions. This kind of constraint exists for all contextual actions - wall running must be at least this length and cover this much area and the player must approach from this angle, climbing a ledge must be at least this tall and have at least this much flat space on top to stand up after ascending, computer keyboards must be this height and this angle in order for the animations to line up, chairs must be a standardized height to match player sitting animations, all stair steps must be the same height in order for the player model’s foot not to clip through them, and so on and so forth. If you carefully observe games like Uncharted and Tomb Raider while playing, you’ll start seeing the standardization in terms of size, spacing, approach angle, etc. of many of their contextual actions.

[Join us on Discord] and/or [Support us on Patreon]

Got a burning question you want answered?

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *