Skip to content

A3D_AttachDynamicObject

imshooter edited this page Oct 17, 2026 · 1 revision

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);

Parameters

Parameter Description
Physic:physicid Physics object to show.
objectid Streamer object that follows it.

Returns

  • true when the streamer object follows it.
  • false when physicid is not a moving physics object.

Remarks

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.

Example

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() {}

Related

  • 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.

Home

Guides

Reference

Functions

Creating objects
Motion
Placement
Behaviour
Display and data
Rays
Shapes
Players, vehicles and actors
Map probes
Screen
Map objects
Water
Models and surfaces
Rotations and offsets
Vehicles
Routes
Route display
Walking
Callbacks

Clone this wiki locally