PhysObj.GetVelocity

From GMod Wiki

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



Example

DescriptionLets you know if the object is moving or not.
Used onNewerServer.png
Code
local phys = self:GetPhysicsObject()
 
//always do a isvalid check!!
if phys:IsValid() then
	if phys:GetVelocity():Length() > 0 then
		//is moving
	else
		//not moving
	end
end
OutputN/A


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox