Phys magnet: Difference between revisions
Jump to navigation
Jump to search
Warning:If a prop model is not specified for this entity, the map will crash with a
Bug:Removing this entity without removing crane can cause crashes. [todo tested in ?]
Risk of Confusion:This is not a typical
Note:Another entity can be used by changing the entity's
No edit summary |
m (Classifying as model entity) |
||
(7 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
[[File:phys_magnet.png|left|link=]] | [[File:phys_magnet.png|left|link=]] | ||
{{CD|CPhysMagnet|file1=physobj.cpp}} | |||
{{ | {{this is a|model entity|name=phys_magnet}} It acts like a magnet, attaching metallic physics objects to itself when they touch it. | ||
{{warning|If a prop model is not specified for this entity, the map will crash with a <code>memory could not be 'read'</code> error.}} | {{warning|If a prop model is not specified for this entity, the map will crash with a <code>memory could not be 'read'</code> error.}} | ||
{{bug|Removing this entity without removing crane can cause crashes.}} | {{bug|Removing this entity without removing crane can cause crashes.}} | ||
{{ModernConfusion|This is not a typical <code>phys_</code> entity, it uses a model}} | |||
{{clr}} | {{clr}} | ||
== Keyvalues == | == Keyvalues == | ||
{{KV Targetname}} | |||
{{KV|Force Limit to Break (lbs)|intn=forcelimit|float|The amount of force necessary to break a stuck object off the magnet. A way of calculating this is to set it to the mass of an object that would break this constraint if it were resting on the magnet.}} | {{KV|Force Limit to Break (lbs)|intn=forcelimit|float|The amount of force necessary to break a stuck object off the magnet. A way of calculating this is to set it to the mass of an object that would break this constraint if it were resting on the magnet.}} | ||
{{KV|Torque Limit to Break (lbs*inches)|intn=torquelimit|float|The amount of torque necessary to break a stuck object off the magnet. A way of calculating this is to multiply any reference mass by the resting distance (from the center of mass of the object) needed to break the constraint.}} | {{KV|Torque Limit to Break (lbs*inches)|intn=torquelimit|float|The amount of torque necessary to break a stuck object off the magnet. A way of calculating this is to multiply any reference mass by the resting distance (from the center of mass of the object) needed to break the constraint.}} | ||
Line 13: | Line 14: | ||
{{KV|Override parameters|intn=overridescript|string|A list of physics key/value pairs that are usually in a physics prop [[QC|.qc file]]. Format is 'key,value,key,value,etc'.}} | {{KV|Override parameters|intn=overridescript|string|A list of physics key/value pairs that are usually in a physics prop [[QC|.qc file]]. Format is 'key,value,key,value,etc'.}} | ||
{{KV|Maximum Attached Objects|intn=maxobjects|integer|The maximum number of physics objects that can be stuck to the magnet at once. 0 {{=}} no limit.}} | {{KV|Maximum Attached Objects|intn=maxobjects|integer|The maximum number of physics objects that can be stuck to the magnet at once. 0 {{=}} no limit.}} | ||
== Flags == | == Flags == | ||
Line 27: | Line 24: | ||
== Inputs == | == Inputs == | ||
{{ | {{I|TurnOn|Turn the magnet on.}} | ||
{{ | {{I|TurnOff|Turn the magnet off. This will detach anything current stuck to the magnet.}} | ||
{{I | {{I|Toggle|Toggle the magnet on or off.}} | ||
== Outputs == | == Outputs == | ||
{{ | {{O|OnAttach|Fired when an entity is grabbed by the magnet.}} | ||
{{ | {{O|OnDetach|Fired when an entity is released by the magnet.}} | ||
== See also == | == See also == | ||
* | * {{ent|prop_vehicle_crane}} | ||
[[Category:Forces]] | [[Category:Forces]] |
Latest revision as of 04:33, 19 May 2025

![]() |
---|
CPhysMagnet |
![]() |
phys_magnet
is a model entity available in all Source games. It acts like a magnet, attaching metallic physics objects to itself when they touch it.

memory could not be 'read'
error.

phys_
entity, it uses a modelKeyvalues
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentname
ortarget
).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
- Force Limit to Break (lbs) (forcelimit) <float>
- The amount of force necessary to break a stuck object off the magnet. A way of calculating this is to set it to the mass of an object that would break this constraint if it were resting on the magnet.
- Torque Limit to Break (lbs*inches) (torquelimit) <float>
- The amount of torque necessary to break a stuck object off the magnet. A way of calculating this is to multiply any reference mass by the resting distance (from the center of mass of the object) needed to break the constraint.
- Mass Scale (massScale) <float>
- A scale multiplier for the object's mass.
- Override parameters (overridescript) <string>
- A list of physics key/value pairs that are usually in a physics prop .qc file. Format is 'key,value,key,value,etc'.
- Maximum Attached Objects (maxobjects) <integer>
- The maximum number of physics objects that can be stuck to the magnet at once. 0 = no limit.
Flags
- 1 : Start Asleep
- 2 : Motion Disabled
- 4 : Suck On Touch
- 8 : Allow Attached Rotation
- 16 : Coast jeep pickup hack - Used on
d2_coast_01 to prevent objects from interfering with the crane as it picks up the buggy. It is hardcoded for use with prop_vehicle_jeep only.

classname
to prop_vehicle_jeep using AddOutput. However, if the game is saved/reloaded or the round restarts in multiplayer, the entity will no longer function and will cause crashes.Inputs
- TurnOn
- Turn the magnet on.
- TurnOff
- Turn the magnet off. This will detach anything current stuck to the magnet.
- Toggle
- Toggle the magnet on or off.
Outputs
- OnAttach
- Fired when an entity is grabbed by the magnet.
- OnDetach
- Fired when an entity is released by the magnet.