Entity:PhysicsInitBox
boolean Entity:PhysicsInitBox( Vector mins, Vector maxs, string surfaceprop = "default", Vector massCenterOverride = nil )
Description
Makes the physics object of the entity a AABB.
This function will automatically destroy any previous physics objects and do the following:
- Entity:SetSolid(
SOLID_BBOX) - Entity:SetMoveType(
MOVETYPE_VPHYSICS) - Entity:SetCollisionBounds(
mins,maxs)
Clientside physics objects on serverside entities do not move properly in some cases. Physics objects should only created on the server or you will experience incorrect physgun beam position, prediction issues, and other unexpected behavior.
A workaround is available on the Entity:PhysicsInitConvex page.
Issue Tracker: 5060
Arguments
3 string surfaceprop = "default"
Physical material from surfaceproperties.txt or added with physenv.AddSurfaceData.
4 Vector massCenterOverride = nil
If set, overwrites the center of mass for the created physics object.
Returns
1 boolean
Returns
true on success, nil otherwise. This fails when the game cannot create any more PhysCollides.
Garry's Mod
Rust
Steamworks
Wiki Help