This article's documentation is for anything that uses the Source engine. Click here for more information.

Func movelinear: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(The math formulae and the relationship between starting position and startposition in the entity comments are incorrect.)
No edit summary
 
(53 intermediate revisions by 30 users not shown)
Line 1: Line 1:
{{wrongtitle|title=func_movelinear}}
{{LanguageBar}}
{{TabsBar}}
{{CD|CFuncMoveLinear|file1=func_movelinear.cpp}}
{{This is a|brush entity|name=func_movelinear}} It moves linearly along a given distance, in a given direction. Unlike a {{ent|func_door}}, it can be positioned anywhere along its axis of movement, making moving things much simpler in most cases while also using less memory. For moving water, use {{ent|func_water_analog}} instead.


==Entity Description==
{{FuncMoveLinear notes}}
A brush entity that moves linearly along a given distance, in a given direction.
{{altnames|name1=momentary_door|misc=This was the original classname in [[GoldSrc]].}}
 
==Flags==
{{Fl FuncMoveLinear}}


==Keyvalues==
==Keyvalues==
* {{kv targetname}}
{{Brush rendering note}}
* {{kv parentname}}
* {{kv origin}}
* '''movedir'''
: <angle> The direction the brush will move, when told to.
* '''startposition'''
: <float> A value defining the start and end points of travel relative to the spawned position (where you place it in the map). The range of the value is 0.0 to 1.0 inclusive. 0 means the start point is at the spawned position. 1 means the end point is at the spawned position. 0.5 means the start and end points are each 1/2 the movedistance from the spawned position. The end point is in the direction '''movedir''' from the spawned position. The start point is (spawn position) - (''value'' * movedistance). The end point is (spawn position) + ((1-''value'') * '''movedistance''').
* '''speed'''
: <integer> The speed that the brush moves, in inches per second.
* '''movedistance'''
: <float> The distance between the start and end points, in inches.
* '''blockdamage'''
: <float> The amount of damage to do to any entity that blocks the brushes, per frame.
* '''startsound'''
: <sound> Sound played when the brush starts moving.
* '''stopsound'''
: <sound> Sound played when the brush stops moving.


==Flags==
{{KV Targetname}}
* 8 : Not Solid
{{KV FuncMoveLinear}}


==Inputs==
==Inputs==
* {{i targetname}}
{{I FuncMoveLinear}}
* {{i parentname}}
* '''Open'''
: Move the brush to the end point.
* '''Close'''
: Move the brush to the start point.
* '''SetPosition <float>'''
: Move the brush to a specific position relative to the start and end points defined by a value. The ''setposition'' value can be from 0 to 1 to move the brush to a position between the start and end ponts. The value can be greater than 1 to move the brush beyond the end point. The value can be less than 0 to move the brush beyond the start point.


==Outputs==
==Outputs==
* {{o targetname}}
{{O FuncMoveLinear}}
* '''OnFullyOpen'''
: Fired when the brush reaches the end point.
* '''OnFullyClosed'''
: Fired when the brush reaches the start point.


[[Category:Entities]][[Category:Brush Entities]]
==See also==
* {{ent|func_water_analog}} - entity linked to to the same C++ class
* [http://twhl.info/vault.php?map=3920 Example map of a counter-weighted door].

Latest revision as of 09:28, 18 September 2024

English (en)Русский (ru)Translate (Translate)
edit
C++ Class hierarchy
CFuncMoveLinear
CBaseToggle
CBaseEntity
C++ func_movelinear.cpp

func_movelinear is a brush entity available in all Source Source games. It moves linearly along a given distance, in a given direction. Unlike a func_door, it can be positioned anywhere along its axis of movement, making moving things much simpler in most cases while also using less memory. For moving water, use func_water_analog instead.

Note.pngNote:The SetPosition input and Start Position keyvalue do not perform any bounds checking, so values less than 0 and greater than 1 can be used. Negative values will move in the opposite direction to the movement direction, and values greater than 1 will move it in multiples of the set Move Distance. Moving past the opened/closed position does not trigger the OnFullyOpen and OnFullyClosed outputs.
Icon-Bug.pngBug:There are bugs that may arise when parenting this entity to any of these: func_movelinear, func_lookdoor, func_water_analog. A func_door (or for func_water_analog, func_water) can be used as a workaround. (see here for a code fix)[ Code Fix]
Confirm:Might be fixed in Portal 2? Parented movelinears are used extensively for this game's piston platforms.
AltNames.pngAltNames: This entity is also tied to momentary_door. This was the original classname in GoldSrc.

Flags

FuncMoveLinear:

Not Solid : [8]
Icon-Bug.pngBug:Physics objects cannot be constrained to this entity when this flag is enabled.  [todo tested in ?]

Keyvalues

Note.pngNote:For Keyvalues and Inputs affecting brush rendering, see Brush entity/Rendering related keyvalues and inputs


Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

FuncMoveLinear:

Move Direction (Pitch Yaw Roll) (movedir) <angle>
The direction the entity will move in.
Start Position (startposition) <float>
Position of brush when spawned, where 0 is the starting position and 1 is starting position + (move direction * move distance).
Speed (speed) <integer>
The speed that the brush moves, in inches per second.
Move Distance (movedistance) <float>
The distance from the starting point that the brush should move, in inches.
Block Damage (blockdamage) <float>
The amount of damage to do to any entity that blocks the brushes, per frame.
Icon-Bug.pngBug:Block damage doesn't function on players who passed through a trigger_teleport using noclip, though it will have effect again if the the player goes through a trigger_teleport without noclip.  [todo tested in ?]
Sound played when the brush starts moving. (startsound) <sound>
The sound to play when the brush starts moving.
Sound played when the brush stops moving. (stopsound) <sound>
The sound to play when the brush stops moving.

Inputs

FuncMoveLinear:

Open
Move the brush to the end position (starting position + (move direction * move distance)).
Close
Move the brush to the starting position.
SetPosition <floatRedirectInput/float>
Move the brush to a specific position, where 0 is the starting position and 1 is the starting position + (move direction * move distance).
SetSpeed <floatRedirectInput/float>
Set the speed and update immediately.
TeleportToTarget <targetnameRedirectInput/string> (only in Left 4 Dead 2)
Teleport to the origin of a given entity.
ResetPosition <floatRedirectInput/float> (only in Left 4 Dead 2)
Set a new start position, parameter relative to wherever the current one is.
Todo: Parameter might actually be optional?

Outputs

FuncMoveLinear:

OnFullyOpen
!activator = !caller = this entity
Fired when the brush reaches the end position (starting position + (move direction * move distance)).
OnFullyClosed
!activator = !caller = this entity
Fired when the brush reaches the starting position.

See also