Description
The OnFootstepEvent
property is an event handler that is triggered whenever a footstep event occurs in the SkinnedModelRenderer
. This property allows you to define custom behavior in response to footstep events, such as playing a sound or triggering an animation.
Usage
To use the OnFootstepEvent
property, assign a method that matches the System.Action<Sandbox.SceneModel/FootstepEvent>
delegate signature. This method will be called whenever a footstep event is detected.
Example
// Example of subscribing to the OnFootstepEvent
SkinnedModelRenderer renderer = new SkinnedModelRenderer();
// Define the method to handle the footstep event
void HandleFootstep(Sandbox.SceneModel.FootstepEvent footstepEvent)
{
// Custom logic for handling the footstep event
// For example, play a footstep sound
Sound.Play("footstep_sound", footstepEvent.Position);
}
// Subscribe to the OnFootstepEvent
renderer.OnFootstepEvent += HandleFootstep;