Repository navigation
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.
The values come from object.dat. The buoyancy is 100.0 over the share of the object the game keeps under water, and the damping matches the air resistance of the game at 50 frames a second.
native bool:A3D_GetModelPhysics(
modelid,
&Float:mass,
&Float:bounce,
&Float:buoyancy,
&Float:damping
);| Parameter | Description |
|---|---|
modelid |
Model to read. |
&Float:mass |
Mass in kilograms, for A3D_CreateObject. |
&Float:bounce |
Bounce, for A3D_SetBounce. |
&Float:buoyancy |
Buoyancy, for A3D_SetBuoyancy. |
&Float:damping |
Loss of speed, for the linear value of A3D_SetDamping. |
-
truewhen the values were written. -
falsewhen the game never moves the model, or the database has no such data.
Only the 826 models of object.dat have this data, the bins, crates, cones, barrels and other objects the game lets players knock over. The values are converted to what the natives of the include take:
| Value | From object.dat
|
|---|---|
mass |
The mass, unchanged. |
bounce |
The elasticity, unchanged. |
buoyancy |
100.0 divided by the share of the object the game keeps under water. |
damping |
The air resistance, turned into a loss of speed per second at the 50 frames a second of the game. |
Some values of the game are odd. The beach ball weighs 1,000 kilograms and several objects that should never move weigh 99,999. Check the mass before using it.
Creates an object that moves as the game moves it.
stock Physic:CreateGameObject(modelid, Float:x, Float:y, Float:z) {
new
Float:mass,
Float:bounce,
Float:buoyancy,
Float:damping,
Physic:physicid
;
if (!A3D_GetModelPhysics(modelid, mass, bounce, buoyancy, damping)) {
return A3D_CreateObject(modelid, x, y, z);
}
physicid = A3D_CreateObject(modelid, x, y, z, 0.0, 0.0, 0.0, mass);
A3D_SetBounce(physicid, bounce);
A3D_SetBuoyancy(physicid, buoyancy);
A3D_SetDamping(physicid, damping, 0.3);
return physicid;
}-
A3D_CreateObject: Create a moving physics object shaped like the collision of a model, or as
models.jsondescribes the model. - A3D_SetBounce: Set how much a physics object bounces.
- A3D_SetBuoyancy: Make a moving physics object float in the water of the map.
- A3D_SetDamping: Set how fast a moving physics object loses speed and spin on its own.
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