Phys magnet

From Valve Developer Community

This point-based entity is available in all Source games.

Table of contents

Entity Description

A prop entity that acts like a magnet, attaching metallic physics objects to itself when they touch it.
Warning.png Warning: If a prop model is not specified for this entity, the map will crash with a memory could not be 'read' error.

Keyvalues

Defines the name that other entities refer to this entity by.
  • hammerid [Episode Two Update]
<integer readonly> This id is used for debugging purposes in Hammer.
Specifies the targetname of this entity's Parent in a movement hierarchy. Child entities move with their Parent.
Pitch Yaw Roll (Y Z X)
This entity's angular orientation in the world (also used for angular effect entities).
  • model
<studio> World Model (Maximum string length: 128)
  • skin
<integer> Some models have multiple versions of their textures called skins. Set this to a number other than 0 to use that skin instead of the default.
  • disableshadows
<boolean> Used to disable dynamic shadow casting from this entity.
  • 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.
  • torquelimit
<float> Torque limit to break, in lbs*distance. 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.
  • massScale
<float> A scale multiplier for the object's mass.
  • 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.
  • 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

Inputs

  • Kill
Removes this entity from the world.
Removes this entity and all its children from the world.
  • AddOutput <string>
Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.
Format: <key> <value>
Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire (-1 == infinite)>
Causes this entity's OnUser1-4 outputs to be fired. See User Inputs and Outputs.
Changes the entity's parent in the movement hierarchy.
Change this entity to attach to a specific attachment point on its parent. Entities must be parented before being sent this input. The parameter passed in should be the name of the attachment.
Change this entity to attach to a specific attachment point on it's parent. Entities must be parented before being sent this input. The parameter passed in should be the name of the attachment. The entity will maintain it's position relative to the Parent's Origin and Angles at the time it is attached.
Removes this entity from its current movement hierarchy.
  • Skin <integer>
Changes the model skin to the specified number.
  • SetBodyGroup <integer>
Set this prop's body group (from 0 - n). Changes the model body to the specified number.
  • DisableShadow
Turn shadow off.
  • EnableShadow
Turn shadow on.
  • AlternativeSorting <bool> [Episode One Update]
Used to attempt to fix sorting problems when rendering. True activates, false deactivates
  • TurnOn
Turn the magnet on.
  • TurnOff
The the magnet off. This will detach anything current stuck to the magnet.

Outputs

Fired in response to FireUser1-4 inputs. See User Inputs and Outputs.
!activator = activator
  • OnIgnite
Fired when this object catches fire.
  • OnAttach
Fired when an entity is grabbed by the magnet.
  • OnDetach
Fired when an entity is released by the magnet.