Class PlayerEntity
Namespace: ValveResourceFormat.Renderer.Entities
Assembly: Renderer.dll
The player as an entity, mirroring an IPlayerController so triggers can touch it and teleports can move it.
public sealed class PlayerEntity : BaseEntityInheritance
object ← BaseEntity ← PlayerEntity
Inherited Members
BaseEntity.Scene, BaseEntity.RootNode, BaseEntity.Transform, BaseEntity.RigidTransform, BaseEntity.EntitySystem, BaseEntity.Data, BaseEntity.SpawnData, BaseEntity.NameFixup, BaseEntity.SpawnGroup, BaseEntity.Classname, BaseEntity.TargetName, BaseEntity.SpawnFlags, BaseEntity.SpawnTransform, BaseEntity.Owner, BaseEntity.MoveParent, BaseEntity.EntityScale, BaseEntity.ModelName, BaseEntity.Origin, BaseEntity.Angles, BaseEntity.WorldOrigin, BaseEntity.WorldAngles, BaseEntity.Velocity, BaseEntity.AngularVelocity, BaseEntity.NextThink, BaseEntity.MoveDoneTime, BaseEntity.IsRemoved, BaseEntity.Collider, BaseEntity.IsSolid, BaseEntity.IsTrigger, BaseEntity.IsDrawn, BaseEntity.IsShown, BaseEntity.IsCollidable, BaseEntity.TouchingEntities, BaseEntity.HasSpawnFlags<TSpawnFlags>(TSpawnFlags), BaseEntity.Spawn(), BaseEntity.Activate(), BaseEntity.Think(), BaseEntity.RoundStart(), BaseEntity.MoveDone(), BaseEntity.TryGetTouchBounds(out Vector3, out Vector3), BaseEntity.ObjectCaps, BaseEntity.Use(BaseEntity?), BaseEntity.Teleport(Vector3, Vector3?), BaseEntity.AcceptInput(string, EntityInputData), BaseEntity.SetNextThink(float), BaseEntity.SetMoveDoneTime(float), BaseEntity.GetSurfaceVelocity(Vector3), BaseEntity.AngleMod(float)
Remarks
The controller owns the position and moves per rendered frame, not on the entity tick, so PlayerEntity.TryGetTouchBounds(out Vector3, out Vector3) reads the hull live rather than the last tick's copy.
Constructors
PlayerEntity(EntitySystem, Scene, IPlayerController)
Creates the player entity for a movement controller.
public PlayerEntity(EntitySystem system, Scene scene, IPlayerController controller)Parameters
system EntitySystem
scene Scene
controller IPlayerController
Properties
Controller
Gets the controller whose state this entity reflects.
public IPlayerController Controller { get; }Property Value
UseRange
How far the player can reach to press something.
public float UseRange { get; set; }Property Value
float
Methods
PhysicsSimulate(float)
Integrates this tick's movement: advances BaseEntity.Origin by BaseEntity.Velocity and turns by BaseEntity.AngularVelocity.
protected override void PhysicsSimulate(float tickInterval)Parameters
tickInterval float
Remarks
Turning is chosen per class by BaseEntity.TurnsByAngleComponents. By default it is about the entity's own axes, so a brush authored on its side spins about its own up axis. Doors and other toggle brushes add the rate onto the QAngle components instead. The two only differ for an entity the map already rotated.
PressUse()
Presses whatever the player is looking at within PlayerEntity.UseRange, the +use command.
public BaseEntity? PressUse()Returns
The entity that was pressed, or null if nothing was in reach.
Teleport(Vector3, Vector3?)
Teleports the player. BaseEntity.WorldOrigin is the feet, as in IPlayerController.Teleport(Vector3, Vector3?), so the destination is passed through unchanged.
public override void Teleport(Vector3 origin, Vector3? angles)Parameters
origin Vector3
angles Vector3?
TryGetTouchBounds(out Vector3, out Vector3)
Reports the box this entity occupies for touch tests, by default the world bounds of its collision shape. Without a shape it occupies no space and cannot be touched.
public override bool TryGetTouchBounds(out Vector3 center, out Vector3 halfExtents)Parameters
center Vector3
halfExtents Vector3
Returns
bool
true when this entity occupies space.
Remarks
A box rather than the real shape, because that is what trigger volumes test against.

