Repository navigation
A3D_SetBuoyancy
Make a moving physics object float in the water of the map.
Without it, objects sink like stones. An object floats with 1.0 / buoyancy of its volume under the surface: 2.0 floats half under, 1.0 stays at any depth, and less sinks slowly. While it touches the water it loses drag of its speed each second, so it settles and rests. A3D_GetModelPhysics gives the buoyancy the game uses for a model.
native bool:A3D_SetBuoyancy(Physic:physicid, Float:buoyancy, Float:drag = 1.0);| Parameter | Description | Default |
|---|---|---|
Physic:physicid |
Physics object to change. | |
Float:buoyancy |
How much it floats, or 0.0 to stop it floating. |
|
Float:drag |
Share of its speed the water takes each second. | 1.0 |
-
truewhen the buoyancy was set. -
falsewhenphysicidis not a moving physics object, or a value is negative.
The water is that of the map database. With a ColAndreas database there is no water and nothing floats.
The push of the water acts on the part of the object under the surface, so an object bobs and settles at the depth its buoyancy gives. A buoyancy of 2.0 floats with half of the object under the surface and 4.0 with a quarter. While the object touches the water, drag takes that share of its speed every second, so it calms down and comes to rest.
The water of an interior placed above the city pushes only objects that are in it, with nothing of the map between them and its surface.
Throws a crate into the sea that floats as in the game.
stock Physic:ThrowCrate(Float:x, Float:y, Float:z) {
new
Float:mass,
Float:bounce,
Float:buoyancy,
Float:damping,
Physic:crate
;
A3D_GetModelPhysics(1271, mass, bounce, buoyancy, damping);
crate = A3D_CreateObject(1271, x, y, z, 0.0, 0.0, 0.0, mass);
A3D_SetBuoyancy(crate, buoyancy);
A3D_SetVelocity(crate, 0.0, 6.0, 3.0);
return crate;
}- A3D_GetModelPhysics: Find how the game moves a model that can be knocked over, such as a bin or a crate, in the values the natives of this include take.
- A3D_GetWaterLevel: Find the height of the water at a point of the map.
- A3D_IsPointInWater: Whether a point lies in the water of the map.
- A3D_SetDamping: Set how fast a moving physics object loses speed and spin on its own.
3DAndreas 0.6.3 · Repository · Releases · MIT License
Guides
- Installation
- Configuration
- Physics objects
- Model settings
- World queries
- The screen
- Map database
- Coming from ColAndreas
- Performance
Reference
Functions