Garry's Mod Wiki

Revision Difference

PhysObj:CalculateForceOffset#546354

<function name="CalculateForceOffset" parent="PhysObj" type="classfunc"> <description>Calculates the force and torque on the center of mass for an offset force impulse. The outputs can be directly passed to <page>PhysObj:ApplyForceCenter</page> and <page>PhysObj:ApplyTorqueCenter</page>, respectively.</description>⤶ <description>Calculates the linear and angular impulse on the center of mass of the object for an offset impulse. The outputs can be directly used with <page>PhysObj:ApplyForceCenter</page> and <page>PhysObj:ApplyTorqueCenter</page>, respectively. **Be careful to convert the angular impulse to world frame if you are going to use it with ApplyTorqueCenter.**</description>⤶ <realm>Shared</realm> <args> <arg name="force" type="Vector">The initial force</arg>⤶ <arg name="pos" type="Vector">The location of the force in world coordinates</arg>⤶ <arg name="impulse" type="Vector">The impulse acting on the object in `kg*source_unit/s`. (World frame)</arg>⤶ <arg name="position" type="Vector">The location of the force in world coordinates (`source units`)</arg>⤶ </args> <rets> <ret name="" type="Vector">The calculated force on the physics object's center of mass</ret>⤶ <ret name="" type="Vector">The calculated torque on the physics object's center of mass</ret>⤶ <ret name="linearImpulse" type="Vector">The calculated linear impulse on the physics object's center of mass in `kg*source_unit/s`. (World frame)</ret>⤶ <ret name="angularImpulse" type="Vector">The calculated angular impulse on the physics object's center of mass in `kg*m^2*degrees/s`. (Local frame)</ret>⤶ </rets> </function>⤶ </function>