Class BaseToggle
Namespace: ValveResourceFormat.Renderer.Entities
Assembly: Renderer.dll
Base for brush entities that travel between two positions, such as buttons and doors.
public abstract class BaseToggle : BaseModelEntityInheritance
object ← BaseEntity ← BaseModelEntity ← BaseToggle
Derived
FuncButton, FuncDoor, FuncMoveLinear, PropDoorRotating
Inherited Members
BaseModelEntity.Solid, BaseModelEntity.ModelNode, BaseModelEntity.Physics, BaseModelEntity.LoadedModel, BaseModelEntity.NonEmpty(string?), BaseModelEntity.CreateRootNode(), BaseModelEntity.BuildsCollider, BaseModelEntity.InputColor(EntityInputData), BaseModelEntity.InputAlpha(EntityInputData), BaseModelEntity.InputSetRenderAttribute(EntityInputData), BaseModelEntity.InputClearRenderAttribute(EntityInputData), BaseModelEntity.InputLightingOrigin(EntityInputData), BaseModelEntity.DispatchInput(string, EntityInputData), BaseEntity.Scene, BaseEntity.RootNode, BaseEntity.Transform, BaseEntity.RigidTransform, BaseEntity.EntitySystem, BaseEntity.Data, BaseEntity.SpawnData, BaseEntity.NameFixup, BaseEntity.SpawnGroup, BaseEntity.KeyValues, 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.CreateRootNode(), BaseEntity.CreateEditorNode(ObjectTypeFlags), BaseEntity.CreateEffect(string?, ParticleSnapshot?, bool), BaseEntity.HasSpawnFlags<TSpawnFlags>(TSpawnFlags), BaseEntity.Spawn(), BaseEntity.Activate(), BaseEntity.Think(), BaseEntity.RoundStart(), BaseEntity.MoveDone(), BaseEntity.TryGetTouchBounds(out Vector3, out Vector3), BaseEntity.AcceptsTouchFrom(BaseEntity), BaseEntity.OnStartTouch(BaseEntity), BaseEntity.OnTouch(BaseEntity), BaseEntity.OnEndTouch(BaseEntity), BaseEntity.ObjectCaps, BaseEntity.Use(BaseEntity?), BaseEntity.Teleport(Vector3, Vector3?), BaseEntity.JumpTo(Vector3, Vector3), BaseEntity.AcceptInput(string, EntityInputData), BaseEntity.InputKill(EntityInputData), BaseEntity.InputFireUser1(EntityInputData), BaseEntity.InputFireUser2(EntityInputData), BaseEntity.InputFireUser3(EntityInputData), BaseEntity.InputFireUser4(EntityInputData), BaseEntity.SetNextThink(float), BaseEntity.SetMoveDoneTime(float), BaseEntity.PhysicsSimulate(float), BaseEntity.TurnsByAngleComponents, BaseEntity.IsPusher, BaseEntity.IsUnblockableByPlayer, BaseEntity.MovesWithoutPushing, BaseEntity.PushesPlayerAsTrain, BaseEntity.HasVPhysicsSolid, BaseEntity.OnStartBlocked(BaseEntity), BaseEntity.OnBlocked(BaseEntity), BaseEntity.OnEndBlocked(), BaseEntity.GetSurfaceVelocity(Vector3), BaseEntity.TurnBody(Vector3, Vector3), BaseEntity.SetOriginAndAngles(Vector3, Vector3), BaseEntity.SetWorldOriginAndAngles(Vector3, Vector3), BaseEntity.AddNode(SceneNode, bool), BaseEntity.OnRemove(), BaseEntity.UpdateTransform(), BaseEntity.UpdateColliderTransform(), BaseEntity.UpdateRenderTransform(float), BaseEntity.SnapInterpolation(), BaseEntity.AngleMod(float), BaseEntity.DispatchInput(string, EntityInputData)
Remarks
A travel gives the entity a constant velocity and a deadline, and the arrival snaps to the exact destination instead of wherever the last tick left it.
Constructors
BaseToggle(EntitySystem, EntitySpawnInfo)
Initializes a moving brush from its keyvalues.
protected BaseToggle(EntitySystem system, EntitySpawnInfo spawnInfo)Parameters
system EntitySystem
spawnInfo EntitySpawnInfo
Properties
FinalDestination
Gets or sets where the brush is heading. Changing it mid-travel keeps the velocity; the brush lands here once its time is up.
protected Vector3 FinalDestination { get; set; }Property Value
IsLinearMoving
Gets whether a BaseToggle.LinearMove(Vector3) is under way.
protected bool IsLinearMoving { get; }Property Value
bool
IsPusher
A travelling brush shoves the player rather than swallowing them.
protected override bool IsPusher { get; }Property Value
bool
Lip
Gets the lip keyvalue: how much of the brush stays proud of its opening.
public float Lip { get; protected set; }Property Value
float
MoveDirection
Gets the direction the brush travels in the world, resolved from its movedir.
protected Vector3 MoveDirection { get; }Property Value
Speed
Gets how fast the brush travels, in units per second.
public float Speed { get; protected set; }Property Value
float
TurnsByAngleComponents
Gets whether a turn adds BaseEntity.AngularVelocity onto the QAngle components rather than turning about the body's own axes. Doors and other toggle brushes do, so their travel between two authored angles is a straight line through the components and lands where it was aimed.
protected override bool TurnsByAngleComponents { get; }Property Value
bool
Methods
AngularMove(Vector3, float)
Turns towards a destination angle at speed degrees per second, arriving when the move-done comes due.
protected void AngularMove(Vector3 destinationAngle, float speed)Parameters
destinationAngle Vector3
speed float
FinishLinearMove()
Ends a travel exactly on its destination. Call from MoveDone before acting on the arrival.
protected bool FinishLinearMove()Returns
bool
true when a travel was in progress and has now landed.
GetAxisDirection(bool, bool)
Reads the axis a rotating brush turns about from its spawnflags. Flag names are for the QAngle component they set, so the "roll" flag is what Hammer labels X Axis.
protected static Vector3 GetAxisDirection(bool rollAxis, bool pitchAxis)Parameters
rollAxis bool
pitchAxis bool
Returns
GetTravelDistance(Vector3)
How far the brush slides: its own length along the travel axis, less the lip that keeps it proud.
protected float GetTravelDistance(Vector3 localDirection)Parameters
localDirection Vector3
The travel direction, in the frame of the brush's own bounds.
Returns
float
Remarks
Deliberately takes off no extra 2 units for bounds padded by 1 unit per side: the compiled collision hulls are unpadded.
LinearMove(Vector3)
Moves towards a destination at BaseToggle.Speed, arriving when the move-done comes due.
protected void LinearMove(Vector3 destination)Parameters
destination Vector3
ResolveEntitySpaceMoveDirection()
Reads the direction a button, door or mover travels. movedir is an angle in the entity's own frame with no special values for up and down, and the entity's orientation carries it into the world, so an instance-rotated door still opens as authored.
protected Vector3 ResolveEntitySpaceMoveDirection()Returns
The direction in the entity's own frame, which is the frame its bounds are measured in.

