Repository navigation
A3D_OnCollided
imshooter edited this page Oct 17, 2026
·
1 revision
A moving physics object hit something faster than its collision speed.
public A3D_OnCollided(Physic:physicid, A3D_HIT:type, hitid, Float:x, Float:y, Float:z, Float:speed)| Parameter | Description |
|---|---|
Physic:physicid |
Physics object that hit. |
A3D_HIT:type |
What it hit. |
hitid |
Model of the map object, or the physics object, static object, player, vehicle or actor it hit. |
Float:x |
Point of contact on the X axis. |
Float:y |
Point of contact on the Y axis. |
Float:z |
Point of contact on the Z axis. |
Float:speed |
Speed of the impact, in metres per second. |
The callback comes once when a contact starts, never while it lasts. It is called in the script that created the object, after the step that saw the impact, and its return value is not used.
-
speedis the speed at which both bodies met, along the line of the contact. Contacts slower than the collision speed of the object,3dandreas.collision_speedby default, call nothing. See A3D_SetCollisionSpeed. - When two moving objects meet, each one gets its own call, in the script that created it, with the other as
hitid. - Only moving objects get calls. The map, static objects, players, vehicles and actors are what they hit.
- An object that falls asleep loses its contacts, so what it rests on counts as a new contact when it wakes. A collision speed above zero keeps those out.
It is safe to destroy the object inside the callback.
Hurts a player by the speed of what hits them.
public A3D_OnCollided(Physic:physicid, A3D_HIT:type, hitid, Float:x, Float:y, Float:z, Float:speed) {
if (type != A3D_HIT_PLAYER) {
return 1;
}
new Float:health;
GetPlayerHealth(hitid, health);
SetPlayerHealth(hitid, health - speed * 2.0);
return 1;
}-
A3D_SetCollisionSpeed: Set the slowest impact of a moving physics object that calls
A3D_OnCollided. -
A3D_OnStopped: A moving physics object came to rest, or fell below
3dandreas.floorand was stopped there. - A3D_SetExtra: Keep a number on a physics object, such as the item it stands for.
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