Class FuncRotating
Namespace: ValveResourceFormat.Renderer.Entities
Assembly: Renderer.dll
func_rotating. A brush that spins about one axis at up to maxspeed degrees per second, either snapping to speed or ramping up and down against fanfriction.
public sealed class FuncRotating : BaseModelEntityInheritance
object ← BaseEntity ← BaseModelEntity ← FuncRotating
Inherited Members
BaseModelEntity.ModelNode, 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
Ported from Source's CFuncRotating, structure included: the speed ramp is a chain of move-done callbacks 0.1s apart (SpinUpMove / SpinDownMove) that hand over to RotateMove at the target speed, and the fixed tick integrates the angles.
The axis flags are named after the code's m_vecMoveAng, a QAngle, so Hammer's "X Axis" sets roll and its "Y Axis" sets pitch, and with neither set the brush yaws about world Z. The mismatch is the engine's, kept so maps rotate the way they do in game.
The brush is solid and the player collides with it as it turns, unless the "Not Solid" flag is set. The "Fan Pain" damage flag is not simulated, nor is the pusher physics that would carry a player standing on it or shove one it turns into.
The sound follows the speed like RampPitchVol, except in pitch: the engine winds the sample from 30% to 100% pitch during spin-up, which the sound player cannot do. Volume still ramps, so a fan fades in and out with its spin. The sound radius flags pick an attenuation, also not exposed, so a small-radius fan carries as far as a large one.
Constructors
FuncRotating(EntitySystem, EntitySpawnInfo)
Initializes a func_rotating from its keyvalues.
public FuncRotating(EntitySystem system, EntitySpawnInfo spawnInfo)Parameters
system EntitySystem
spawnInfo EntitySpawnInfo
Properties
FanFriction
Gets the ramp friction, fanfriction as a fraction.
public float FanFriction { get; }Property Value
IsReversed
Gets whether the Reverse input flipped the spin direction.
public bool IsReversed { get; }Property Value
MaxSpeed
Gets the top rotation speed in degrees per second.
public float MaxSpeed { get; }Property Value
MoveAngles
Gets the axis to rotate about, as a QAngle direction. Source's m_vecMoveAng.
public Vector3 MoveAngles { get; }Property Value
SoundName
Gets the sound played while the brush turns, the message keyvalue.
public string? SoundName { get; }Property Value
Speed
Gets the current rotation speed in degrees per second; negative spins in reverse.
public float Speed { get; }Property Value
TargetSpeed
Gets the speed being ramped towards.
public float TargetSpeed { get; }Property Value
Volume
Gets the volume that sound reaches at full speed, 0 to 1. Authored as volume, 0 to 10.
public float Volume { get; }Property Value
Methods
MoveDone()
Runs when comes due, after the tick's movement was applied.
public override void MoveDone()OnRemove()
Called as the entity leaves the world, before its nodes are taken out of the scene. Source's UpdateOnRemove: the place to let go of anything the entity started, such as a playing sound.
protected override void OnRemove()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.
SetTargetSpeed(float)
Sets the speed in degrees per second to ramp towards, or jumps straight to it when the brush does not accelerate. The sign comes from the reverse state, not from the speed passed in.
public void SetTargetSpeed(float speed)Parameters
speed float
Spawn()
Sets up the entity: loads its model, reads class-specific keyvalues, and schedules its first think. Called by right after construction, before the entity enters the world.
public override void Spawn()Think()
Starts a brush that spawned switched on. That deferred toggle is the only think this entity schedules, so there is nothing to dispatch on.
public override void Think()Toggle()
Starts the brush if it is stopped, stops it if it is spinning. Source's RotatingUse, which is what a player pressing use, or the Toggle input, ends up calling.
public void Toggle()
