Entity.PhysicsInitBox

From GMod Wiki

Revision as of 18:44, 7 April 2011 by nüke (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax Entity:PhysicsInitBox( Vector min, Vector max )
Description:
In a scripted entity's initilization event, this function will give the entity the physics model of a box. The box's corners are min and max (see additional notes for more information).
Returns: nil
In Object: Entity
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.PhysicsInitBox]Entity.PhysicsInitBox [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCreate a physics entity with a 10x10x10 box physics model.
Used onNewerServer.png
Code
 
function ENT:Initialize()
    local w=10  //Width
    local l=10  //Length
    local h=10  //Height
 
    //Vectors
    local min=Vector(0-(w/2),0-(l/2),0-(h/2))
    local max=Vector(w/2,l/2,h/2)
 
    //Give it some kind of model
    self:SetModel("models/BarneyHelmet_faceplate.mdl")
 
    //Set physics box
    self:PhysicsInitBox(min,max)
 
    //Set bounding box - this will be used for triggers and 
    //determining if rendering is necessary clientside)
    self:SetCollisionBounds(min,max)
end
 
OutputN/A


Additional Notes

Physics Box, Min and Max vectors. Convergence point of black lines is 0,0,0

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox