Repository navigation
A3D_AttachDynamicObject
Show a moving physics object with a streamer object instead of a global object.
The global object is destroyed, and the component moves the streamer object from then on.
native bool:A3D_AttachDynamicObject(Physic:physicid, objectid);| Parameter | Description |
|---|---|
Physic:physicid |
Physics object to show. |
objectid |
Streamer object that follows it. |
-
truewhen the streamer object follows it. -
falsewhenphysicidis not a moving physics object.
A streamer object can be limited to a virtual world, an interior or some players, and the streamer only sends it to players nearby. It suits physics objects in many worlds and large numbers of them.
The include moves the streamer object through @A3D_MoveDynamicObject, a public it declares when it is included after streamer.inc. The component calls it in the script that created the physics object, so create the streamer object in that script too.
The global object of the physics object, if it had one, is destroyed. The streamer object is never destroyed by the component. Destroy it yourself when the physics object goes, for example with an id kept by A3D_SetExtra.
A ball that only the players of one virtual world see.
#include <open.mp>
#include <streamer>
#include <3DAndreas>
#define BALL_STREAMER_OBJECT 0
stock Physic:CreateWorldBall(Float:x, Float:y, Float:z, worldid) {
new
Physic:ball = A3D_CreateSphere(-1, 0.3, x, y, z, 0.5, worldid),
objectid
;
if (ball == INVALID_PHYSIC_ID) {
return INVALID_PHYSIC_ID;
}
objectid = CreateDynamicObject(1598, x, y, z, 0.0, 0.0, 0.0, worldid);
A3D_AttachDynamicObject(ball, objectid);
A3D_SetExtra(ball, BALL_STREAMER_OBJECT, objectid);
return ball;
}
stock DestroyWorldBall(Physic:ball) {
DestroyDynamicObject(A3D_GetExtra(ball, BALL_STREAMER_OBJECT));
A3D_DestroyObject(ball);
}
main() {}- A3D_GetObjectID: The global object that shows a physics object.
- A3D_SetWorld: Move a physics object, a static object or a zone to another virtual world.
- A3D_SetSyncError: Set how far the object players see may stray from the body before a new move is sent.
- A3D_DestroyObject: Destroy a physics object, a static object or a zone, and the global object that shows it.
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