EntityClient

applyForceToEntityCenterOfMass

APPLY_FORCE_TO_ENTITY_CENTER_OF_MASS0x18FF00FC7EFF559E

The GTA V native APPLY_FORCE_TO_ENTITY_CENTER_OF_MASS of the ENTITY namespace, as LS:MP client scripts call it: the global function applyForceToEntityCenterOfMass, in JavaScript and in Lua.

SignatureJavaScript
applyForceToEntityCenterOfMass(
  entity: Entity,
  forceType: number,
  x: number,
  y: number,
  z: number,
  p5: boolean,
  isDirectionRel: boolean,
  isForceRel: boolean,
  p8: boolean
): void
SignatureLua
applyForceToEntityCenterOfMass(
  entity: Entity,
  forceType: integer,
  x: number,
  y: number,
  z: number,
  p5: boolean,
  isDirectionRel: boolean,
  isForceRel: boolean,
  p8: boolean
)

Usage

JavaScript
applyForceToEntityCenterOfMass(entity, forceType, x, y, z, p5, isDirectionRel, isForceRel, p8);
Lua
applyForceToEntityCenterOfMass(entity, forceType, x, y, z, p5, isDirectionRel, isForceRel, p8)

Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.

JavaScript · with vectors
applyForceToEntityCenterOfMass(entity, forceType, pos, p5, isDirectionRel, isForceRel, p8);
Lua · with vectors
applyForceToEntityCenterOfMass(entity, forceType, pos, p5, isDirectionRel, isForceRel, p8)

Parameters

ParameterTypeJavaScriptLua
entityEntitynumberinteger
forceTypeintnumberinteger
xfloatnumbernumber
yfloatnumbernumber
zfloatnumbernumber
p5BOOLbooleanboolean
isDirectionRelBOOLbooleanboolean
isForceRelBOOLbooleanboolean
p8BOOLbooleanboolean

Returns

Nothing. In JavaScript the call evaluates to undefined.

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

Applies a force to the specified entity.

List of force types (p1):

public enum ForceType
{
    MinForce = 0,
    MaxForceRot = 1,
    MinForce2 = 2,
    MaxForceRot2 = 3,
    ForceNoRot = 4,
    ForceRotPlusForce = 5
}

Research/documentation on the gtaforums can be found here https://gtaforums.com/topic/885669-precisely-define-object-physics/) and here https://gtaforums.com/topic/887362-apply-forces-and-momentums-to-entityobject/.

p6/relative - makes the xyz force not relative to world coords, but to something else
p7/highForce - setting false will make the force really low

Reference

Namespace
Entity ENTITY
In the game
void APPLY_FORCE_TO_ENTITY_CENTER_OF_MASS(Entity entity, int forceType, float x, float y, float z, BOOL p5, BOOL isDirectionRel, BOOL isForceRel, BOOL p8)
Hash
0x18FF00FC7EFF559E

Open in the interactive natives reference