Entity/PhysicsInitStatic

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Remove next update tag)
(Bug)
Line 1: Line 1:
 
{{Func
 
{{Func
|Description=Initializes a static physics object of the entity using its current model. Deletes the previous physics object if there was any.
+
|Description=Initializes a static physics object of the entity using its [[Entity/GetModel|current model]]. If successful, the previous physics object is removed.
  
 
This is what used by entities such as func_breakable, prop_dynamic, item_suitcharger, prop_thumper and npc_rollermine while it is in its "buried" state in the Half-Life 2 Campaign.
 
This is what used by entities such as func_breakable, prop_dynamic, item_suitcharger, prop_thumper and npc_rollermine while it is in its "buried" state in the Half-Life 2 Campaign.
Line 6: Line 6:
 
If the entity's current model has no physics mesh associated to it, no physics object will be created.
 
If the entity's current model has no physics mesh associated to it, no physics object will be created.
  
{{Note|This function will automatically set {{ClassFunction|Entity|SetSolid}} with the {{Enum|SOLID}} given.}}
+
{{Note|This function will automatically call {{ClassFunction|Entity|SetSolid}}( solidType ).}}
 +
 
 +
{{Bug|Clientside physics objects are broken and do not move properly. Physics objects should only created on the server or you will experience incorrect physgun beam position and prediction issues.}}
 
|Realm=Shared
 
|Realm=Shared
 
|IsClass=Yes
 
|IsClass=Yes
Line 17: Line 19:
 
{{Ret
 
{{Ret
 
|type=boolean
 
|type=boolean
|desc=Returns true on success, false otherwise.
+
|desc=Returns true on success, false otherwise. This will fail if the entity's current model has no associated physics mesh.
 
}}
 
}}

Revision as of 08:22, 10 August 2018

 Entity:PhysicsInitStatic( )

Description

Initializes a static physics object of the entity using its current model. If successful, the previous physics object is removed.

This is what used by entities such as func_breakable, prop_dynamic, item_suitcharger, prop_thumper and npc_rollermine while it is in its "buried" state in the Half-Life 2 Campaign.

If the entity's current model has no physics mesh associated to it, no physics object will be created.

NOTE

This function will automatically call Entity:SetSolid( solidType ).

BUG

Clientside physics objects are broken and do not move properly. Physics objects should only created on the server or you will experience incorrect physgun beam position and prediction issues.

Arguments

number solidType

The solid type of the physics object to create, see SOLID_ Enums. Should be SOLID_VPHYSICS in most cases.

Returns

boolean

Returns true on success, false otherwise. This will fail if the entity's current model has no associated physics mesh.
Personal tools
Navigation