Entity.PhysicsInitSphere

From GMod Wiki

Jump to: navigation, search
Function
Syntax Entity:PhysicsInitSphere( Float radius[, String material] )
Description:
In a scripted entity's initilization event, this function will give the entity a spherical physics model. The radius is the radius of the sphere.
Returns: nil
In Object: Entity
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.PhysicsInitSphere]Entity.PhysicsInitSphere [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCreate a physics entity with a 20 units wide sphere physics model.
Used onNewerServer.png
Code
function ENT:Initialize()
    local d=20  //Diameter
    local r=d/2 //Radius
    //Give it some kind of model (not necessary but just for ease of coding)
    self:SetModel("models/BarneyHelmet_faceplate.mdl")
 
    //Set physics box
    self:PhysicsInitSphere(r)
 
    //Set bounding box - this will be used for triggers and 
    //determining if rendering is necessary clientside)
    self:SetCollisionBounds(Vector(-r,-r,-r),Vector(r,r,r))
end
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox