Description
The GroundSurface
property of the PlayerController
class represents the surface on which the player is currently standing. It provides information about the type of surface, which can be useful for determining movement behavior, sound effects, and other interactions based on the surface material.
Usage
Use the GroundSurface
property to access the surface type the player is currently standing on. This can be used to adjust player movement, play specific sound effects, or trigger other game logic based on the surface type.
Example
// Example of using GroundSurface in a PlayerController
public class MyPlayerController : PlayerController
{
public void CheckSurface()
{
if (GroundSurface != null)
{
// Example: Print the surface type
Log.Info($"Standing on surface: {GroundSurface.Type}");
// Example: Adjust player speed based on surface type
if (GroundSurface.Type == SurfaceType.Slippery)
{
// Reduce friction or increase speed
}
}
}
}