Garry's Mod Wiki

Revision Difference

PhysObj:ApplyForceOffset#510915

<function name="ApplyForceOffset" parent="PhysObj" type="classfunc">⤶ <description>Applies the specified force on the physics object at the specified position</description>⤶ <realm>Shared</realm>⤶ <args>⤶ <arg name="force" type="Vector">The force to be applied.</arg>⤶ <arg name="position" type="Vector">The position in world coordinates where the force is applied to the physics object.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Pull what the player is looking at towards him.</description>⤶ <code>⤶ 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⤶ </code>⤶ ⤶ </example>