Garry's Mod Wiki

Garry's Mod Wiki

  PhysObj:ApplyForceOffset( Vector impulse, Vector position )

Description

Applies the specified impulse on the physics object at the specified position.

Arguments

1 Vector impulse
The impulse to be applied in kg*source_unit/s. (World frame)
2 Vector position
The position in world coordinates (source units) where the force is applied to the physics object.

Example

Pull what the player is looking at towards him.

local tr = Entity(1):GetEyeTrace() if IsValid(tr.Entity) then local phys = tr.Entity:GetPhysicsObjectNum(tr.PhysicsBone) local pushvec = tr.Normal * -100000 local pushpos = tr.HitPos phys:ApplyForceOffset(pushvec, pushpos) end

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...