Phys convert: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
 Note:phys_convert cannot be used in reverse. (cannot turn physically simulated entities into arbitrary entities)
Note:phys_convert cannot be used in reverse. (cannot turn physically simulated entities into arbitrary entities)
 Note:Name, model, pose, children, position and velocity are retained after conversion. Keyvalues, e.g. skin and color, are not kept. AddOutput could be used as a workaround depending on the circumstances.
Note:Name, model, pose, children, position and velocity are retained after conversion. Keyvalues, e.g. skin and color, are not kept. AddOutput could be used as a workaround depending on the circumstances.
		
	
|  (Filled in "Model Swap Entity" keyvalue and questioned the bug about where the converted object may spawn.) |  (→Outputs:  activator) | ||
| (18 intermediate revisions by 10 users not shown) | |||
| Line 1: | Line 1: | ||
| {{ | {{CD|CPhysConvert|file1=physobj.cpp}} | ||
| {{this is a|logical entity|name=phys_convert}} It copies the physical and visual properties of an arbitrary entity onto a new physically simulated entity. | |||
| The original entity is deleted if successful. Brush entities will turn into [[simple_physics_brush]] and model entities will turn into [[simple_physics_prop]]. Both are very limited compared to [[func_physbox]] and [[prop_physics]]. See their respective pages for details. | |||
| {{note|phys_convert cannot be used in reverse. (cannot turn physically simulated entities into arbitrary entities)}} | |||
| == Keyvalues == | == Keyvalues == | ||
| {{KV Targetname}} | {{KV Targetname}} | ||
| {{KV|Entity to convert|target_destination|intn=target|Name of the entity that will be converted to a physics object when the <code>ConvertTarget</code> input is fired.}} | |||
| {{KV|Model Swap Entity|string|intn=swapmodel|If specified, the model of the entity specified here will replace the model of the target object when it is converted. {{tip|Use this when the converted object has a separate model used for physics props. (e.g. converting "coolthing001a" when "coolthing001a_physics" exists)}}}} | |||
| {{KV|Mass Override|float|intn=massoverride|Sets the mass when the object(s) are converted (0 means auto-calculate)}} | |||
| == Flags == | == Flags == | ||
| {{fl|1|Convert Asleep}} | |||
| {{fl|2|Convert As Debris}} | |||
| == Inputs == | == Inputs == | ||
| {{ | {{I|ConvertTarget|Converts this entity's target to a physically simulated object.}} | ||
| {{ | {{note|Name, model, pose, children, position and velocity are retained after conversion. Keyvalues, e.g. skin and color, are not kept. [[AddOutput]] could be used as a workaround depending on the circumstances.}} | ||
| {{ | : {{codenote|Which fields are transferred can be changed by modifying <code>CPhysConvert::InputConvertTarget()</code>.}} | ||
| == Outputs == | == Outputs == | ||
| {{ | {{O|OnConvert|activator = activator of the ConvertTarget input|Fires after the conversion has taken place.}} | ||
| == See also == | == See also == | ||
| * [[Blowout Doors]] - A phys_convert in use | * [[Blowout Doors]] - A phys_convert in use. | ||
Latest revision as of 06:24, 29 April 2025
|  Class hierarchy | 
|---|
| CPhysConvert | 
|  physobj.cpp | 
phys_convert  is a   logical entity  available in all  Source games. It copies the physical and visual properties of an arbitrary entity onto a new physically simulated entity.
The original entity is deleted if successful. Brush entities will turn into simple_physics_brush and model entities will turn into simple_physics_prop. Both are very limited compared to func_physbox and prop_physics. See their respective pages for details.
 Source games. It copies the physical and visual properties of an arbitrary entity onto a new physically simulated entity.
The original entity is deleted if successful. Brush entities will turn into simple_physics_brush and model entities will turn into simple_physics_prop. Both are very limited compared to func_physbox and prop_physics. See their respective pages for details.
 Note:phys_convert cannot be used in reverse. (cannot turn physically simulated entities into arbitrary entities)
Note:phys_convert cannot be used in reverse. (cannot turn physically simulated entities into arbitrary entities)Keyvalues
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentnameortarget).
 Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
- Entity to convert (target) <targetname>
- Name of the entity that will be converted to a physics object when the ConvertTargetinput is fired.
- Model Swap Entity (swapmodel) <string>
- If specified, the model of the entity specified here will replace the model of the target object when it is converted.  Tip:Use this when the converted object has a separate model used for physics props. (e.g. converting "coolthing001a" when "coolthing001a_physics" exists) Tip:Use this when the converted object has a separate model used for physics props. (e.g. converting "coolthing001a" when "coolthing001a_physics" exists)
- Mass Override (massoverride) <float>
- Sets the mass when the object(s) are converted (0 means auto-calculate)
Flags
- Convert Asleep : [1]
- Convert As Debris : [2]
Inputs
- ConvertTarget
- Converts this entity's target to a physically simulated object.
 Note:Name, model, pose, children, position and velocity are retained after conversion. Keyvalues, e.g. skin and color, are not kept. AddOutput could be used as a workaround depending on the circumstances.
Note:Name, model, pose, children, position and velocity are retained after conversion. Keyvalues, e.g. skin and color, are not kept. AddOutput could be used as a workaround depending on the circumstances. Code:Which fields are transferred can be changed by modifying Code:Which fields are transferred can be changed by modifying- CPhysConvert::InputConvertTarget().
Outputs
- OnConvert
- !activator = activator of the ConvertTarget input
 !caller = this entity
 Fires after the conversion has taken place.
See also
- Blowout Doors - A phys_convert in use.
