Class BaseToggle
Namespace: ValveResourceFormat.Renderer.Entities
Assembly: Renderer.dll
The base of the brush entities that travel between two places, Source's CBaseToggle: buttons, doors, and anything else that slides open and shut.
public abstract class BaseToggle : BaseModelEntityInheritance
object ← BaseEntity ← BaseModelEntity ← BaseToggle
Derived
FuncButton, FuncDoor, FuncMoveLinear, PropDoorRotating
Inherited Members
BaseModelEntity.Solid, BaseModelEntity.ModelNode, BaseModelEntity.LoadedModel, BaseModelEntity.CreateRootNode(), BaseModelEntity.BuildsCollider, BaseModelEntity.InputColor(EntityInputData), BaseModelEntity.InputAlpha(EntityInputData), BaseEntity.Scene, BaseEntity.RootNode, BaseEntity.Transform, BaseEntity.RigidTransform, BaseEntity.LayerName, BaseEntity.EntitySystem, BaseEntity.Data, BaseEntity.SpawnData, BaseEntity.NameFixup, 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.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)
Remarks
The travel is a LinearMove, not an interpolation: the entity is given a constant velocity and a deadline, the tick integrates it like anything else that moves, and the arrival lands on the exact destination rather than wherever the last tick happened to leave 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. A travel under way keeps its velocity when this changes, and lands here once its time is up.
protected Vector3 FinalDestination { get; set; }Property Value
IsLinearMoving
Gets whether a or is under way.
protected bool IsLinearMoving { get; }Property Value
IsPusher
A travelling brush shoves the player rather than swallowing them.
protected override bool IsPusher { get; }Property Value
Lip
Gets or sets how much of the brush stays proud of its opening, the lip keyvalue.
public float Lip { get; protected set; }Property Value
MoveDirection
Gets the direction the brush travels in the world, resolved from its movedir.
protected Vector3 MoveDirection { get; }Property Value
Speed
Gets or sets how fast the brush travels, in units per second.
public float Speed { get; protected set; }Property Value
TurnsByAngleComponents
Gets whether a turn adds onto the QAngle components rather than turning the body about its own axes. The 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
Methods
AngularMove(Vector3, float)
Turns towards a destination angle at speed degrees per second, arriving when the move-done comes due. Source's CBaseToggle::AngularMove.
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
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. Source's CBaseToggle::AxisDir, whose flag names are for the QAngle component they set, so its "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
Remarks
Source 1 subtracts a further 2 units because its engine hands it a brush bound that is 1 unit larger in every direction. CS2 measures the unpadded bounds, and so do the compiled collision hulls here.
LinearMove(Vector3)
Sets off towards a destination at , arriving when the move-done comes due. Source's CBaseToggle::LinearMove: constant velocity and a deadline, not a lerp.
protected void LinearMove(Vector3 destination)Parameters
destination Vector3
ResolveEntitySpaceMoveDirection()
Reads the direction a button, door or mover travels, the way CS2 reads it: movedir is an angle in the entity's own frame, with none of Source 1's magic values for up and down, and the entity's orientation carries it into the world. A door rotated by its instance therefore still opens the way it was authored to.
protected Vector3 ResolveEntitySpaceMoveDirection()Returns
The direction in the entity's own frame, which is the frame its bounds are measured in.

