Repository navigation
A3D_SetVelocity
imshooter edited this page Oct 17, 2026
·
1 revision
Set the velocity of a moving physics object and wake it up.
native bool:A3D_SetVelocity(Physic:physicid, Float:vx, Float:vy, Float:vz);| Parameter | Description |
|---|---|
Physic:physicid |
Physics object to push. |
Float:vx |
Velocity on the X axis, in metres per second. |
Float:vy |
Velocity on the Y axis, in metres per second. |
Float:vz |
Velocity on the Z axis, in metres per second. |
-
truewhen the velocity was set. -
falsewhenphysicidis not a moving physics object.
The velocity replaces the one the object had, whatever its mass. The spin is kept. To push by an amount that depends on the mass, use A3D_ApplyImpulse.
Kicks a ball away from a player, along the ground and a little up.
stock KickBall(playerid, Physic:ball, Float:speed) {
new
Float:x,
Float:y,
Float:z,
Float:ballX,
Float:ballY,
Float:ballZ,
Float:distance
;
GetPlayerPos(playerid, x, y, z);
if (!A3D_GetPosition(ball, ballX, ballY, ballZ)) {
return;
}
distance = VectorSize(ballX - x, ballY - y, 0.0);
if (distance == 0.0) {
return;
}
A3D_SetVelocity(ball, (ballX - x) / distance * speed, (ballY - y) / distance * speed, speed * 0.3);
}- A3D_GetVelocity: The velocity of a moving physics object.
- A3D_ApplyImpulse: Push a moving physics object through its centre of mass.
- A3D_SetAcceleration: Push a moving physics object with a constant acceleration until it is set to zero.
- A3D_GetSpeed: The speed of a moving physics object.
3DAndreas 0.7.1 · Repository · Releases · MIT License
Guides
- Installation
- Configuration
- Physics objects
- Model settings
- World queries
- The screen
- Routes
- Navigation mesh
- Map database
- Coming from ColAndreas
- Performance
Reference
Functions