Skip to content

A3D_SetGravity

imshooter edited this page Oct 17, 2026 · 1 revision

Set how strongly a moving physics object falls.

native bool:A3D_SetGravity(Physic:physicid, Float:gravity);

Parameters

Parameter Description
Physic:physicid Physics object to change.
Float:gravity Gravity in metres per second squared. Starts at 9.81, and 0.0 floats.

Returns

  • true when the gravity was set.
  • false when physicid is not a moving physics object.

Remarks

Every moving object starts at the gravity of the game, 9.81. A gravity of 0.0 makes an object drift as if in space, and a negative one makes it rise like a balloon. The damping still slows it down.

Example

stock Physic:CreateFloatingBall(Float:x, Float:y, Float:z) {
    new Physic:ball = A3D_CreateSphere(1598, 0.3, x, y, z, 0.5);

    A3D_SetGravity(ball, 0.0);

    return ball;
}

Related

  • A3D_SetAcceleration: Push a moving physics object with a constant acceleration until it is set to zero.
  • A3D_SetPlanar: Keep a moving physics object at its height, so it only moves along the ground.
  • A3D_PredictTrajectory: Follow something thrown, such as a grenade, and find where it first lands.

Home

Guides

Reference

Functions

Creating objects
Motion
Placement
Behaviour
Display and data
Rays
Shapes
Players, vehicles and actors
Map probes
Screen
Map objects
Water
Models and surfaces
Rotations and offsets
Vehicles
Routes
Route display
Walking
Callbacks

Clone this wiki locally