PhysObj.AddVelocity

From GMod Wiki

Jump to: navigation, search
Function
Syntax PhysObj:AddVelocity( Vector velocity )
Description:
Adds the Vector to the current velocity of the object.
Returns: nil
In Object: Physobj
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=PhysObj.AddVelocity]PhysObj.AddVelocity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Example

DescriptionForces a scripted entity to move upwards.
Used onNewerServer.png
Code
function ENT:Think()
    local phys = self:GetPhysicsObject()
 
    if phys:IsValid() then
        phys:AddVelocity( Vector(0, 0, 1000) )
    end
end
OutputThe entity will keep moving up.


Additional Notes

See Also

Kdict.pngThis page needs reviewing. An expert needs to verify that all of the information in this page is correct.
See more articles for review here.
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox