Class PlayerEntity
Namespace: ValveResourceFormat.Renderer.Entities
Assembly: Renderer.dll
The player, as an entity the rest of the world can see. Source's CBasePlayer is an entity like any other; here the movement itself still lives behind an , and this mirrors it into the entity world so triggers have something to touch and teleports something to move.
public sealed class PlayerEntity : BaseEntityInheritance
object ← BaseEntity ← PlayerEntity
Inherited Members
BaseEntity.Scene, BaseEntity.RootNode, BaseEntity.Transform, BaseEntity.LayerName, BaseEntity.EntitySystem, BaseEntity.Data, BaseEntity.Classname, BaseEntity.TargetName, BaseEntity.SpawnFlags, BaseEntity.ParentTransform, BaseEntity.EntityScale, BaseEntity.ModelName, BaseEntity.Origin, BaseEntity.Angles, BaseEntity.Velocity, BaseEntity.AngularVelocity, BaseEntity.NextThink, BaseEntity.MoveDoneTime, BaseEntity.IsRemoved, BaseEntity.Collider, BaseEntity.IsSolid, BaseEntity.IsTrigger, BaseEntity.IsCollidable, BaseEntity.TouchingEntities, BaseEntity.HasSpawnFlags<TSpawnFlags>(TSpawnFlags), BaseEntity.Spawn(), BaseEntity.Activate(), BaseEntity.Think(), BaseEntity.MoveDone(), BaseEntity.TryGetTouchBounds(out Vector3, out Vector3), BaseEntity.Teleport(Vector3, Vector3?), BaseEntity.AcceptInput(string, EntityInputData), BaseEntity.SetNextThink(float), BaseEntity.SetMoveDoneTime(float), BaseEntity.AngleMod(float)
Remarks
Position comes from the controller rather than being simulated: the player moves off the input, per rendered frame, not on the entity tick. This entity is only a view onto that state, so
reads the hull live rather than the last tick's copy.Constructors
PlayerEntity(EntitySystem, IPlayerController)
Creates the player entity for a movement controller.
public PlayerEntity(EntitySystem system, IPlayerController controller)Parameters
system EntitySystem
controller IPlayerController
Properties
Controller
Gets the controller whose state this entity reflects.
public IPlayerController Controller { get; }Property Value
Methods
PhysicsSimulate(float)
Integrates this tick's movement, advancing by and turning by .
protected override void PhysicsSimulate(float tickInterval)Parameters
tickInterval float
Remarks
The turn goes about the entity's own axes, not onto the QAngle components. Source 1 adds the components (physics_main.cpp: angles += GetLocalAngularVelocity() * movetime), Source 2 turns the body, and these are Source 2 maps. The two only differ for an entity the map already rotated, such as a brush authored on its side, which would otherwise yaw about the world's up axis.
Teleport(Vector3, Vector3?)
Teleports the player. is the feet, which is what
takes, so the destination passes straight through.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, which by default is the world-space bounds of its collision shape. An entity with no shape has no volume and cannot be touched, so it says so.
public override bool TryGetTouchBounds(out Vector3 center, out Vector3 halfExtents)Parameters
center Vector3
halfExtents Vector3
Returns
true when this entity occupies space.
Remarks
A box rather than the real shape, because that is what trigger volumes test against, here and in the engine.

