Repository navigation
A3D_GetReflection
imshooter edited this page Oct 17, 2026
·
1 revision
Find the direction something takes after bouncing off a surface, such as a bullet that ricochets.
native bool:A3D_GetReflection(
Float:directionX,
Float:directionY,
Float:directionZ,
Float:normalX,
Float:normalY,
Float:normalZ,
&Float:x,
&Float:y,
&Float:z
);| Parameter | Description |
|---|---|
Float:directionX |
Direction before the bounce on the X axis. |
Float:directionY |
Direction on the Y axis. |
Float:directionZ |
Direction on the Z axis. |
Float:normalX |
Normal of the surface on the X axis. |
Float:normalY |
Normal on the Y axis. |
Float:normalZ |
Normal on the Z axis. |
&Float:x |
Direction after the bounce on the X axis, as long as before. |
&Float:y |
Direction on the Y axis. |
&Float:z |
Direction on the Z axis. |
-
truewhen the direction was written. -
falsewhen the normal has no length.
The direction mirrors on the surface: the part along the normal turns back and the part along the surface stays. Its length stays too, so a velocity reflects into the velocity after a perfect bounce.
Follows a bullet that ricochets once off the map.
stock bool:GetRicochetEnd(Float:x, Float:y, Float:z, Float:directionX, Float:directionY, Float:directionZ, &Float:endX, &Float:endY, &Float:endZ) {
new
Float:hitX,
Float:hitY,
Float:hitZ,
Float:normalX,
Float:normalY,
Float:normalZ,
Float:bounceX,
Float:bounceY,
Float:bounceZ
;
if (!A3D_RayCastNormal(x, y, z, x + directionX * 100.0, y + directionY * 100.0, z + directionZ * 100.0, hitX, hitY, hitZ, normalX, normalY, normalZ, .flags = A3D_COLLIDE_MAP)) {
return false;
}
A3D_GetReflection(directionX, directionY, directionZ, normalX, normalY, normalZ, bounceX, bounceY, bounceZ);
return A3D_RayCast(hitX, hitY, hitZ, hitX + bounceX * 50.0, hitY + bounceY * 50.0, hitZ + bounceZ * 50.0, endX, endY, endZ);
}- A3D_RayCastNormal: Find the first thing a segment hits, and the direction its surface faces there.
- A3D_GetSurfaceRotation: Find the rotation that stands an object on a surface, such as a crate on a slope.
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