@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.
65 lines (64 loc) • 2.57 kB
TypeScript
import { Object3D } from "three";
import { Behaviour } from "../Component.js";
import { XRFlag } from "./XRFlag.js";
export declare const debug: string | number | boolean;
/**
* Event arguments for avatar marker creation and destruction events
*/
export type AvatarMarkerEventArgs = {
/** The AvatarMarker component instance */
avatarMarker: AvatarMarker;
/** The GameObject that contains the avatar marker */
gameObject: Object3D;
};
/**
* Marks a GameObject as being controlled or owned by a player in networked XR sessions.
* This is used internally by the networking system to identify player-controlled objects.
*
* **Note:** This is an internal marker class. For most use cases, use the {@link Avatar} component instead.
*
* @summary Internal marker for player-controlled objects in networked sessions
* @category XR
* @category Networking
* @group Components
* @see {@link Avatar} for avatar setup and configuration
*/
export declare class AvatarMarker extends Behaviour {
/**
* Get an avatar marker by index from the global list of avatar markers.
* @param index The index in the instances array
* @returns The AvatarMarker at the specified index, or null if index is out of bounds
*/
static getAvatar(index: number): AvatarMarker | null;
/** Global list of all active AvatarMarker instances */
static instances: AvatarMarker[];
/**
* Subscribe to avatar marker creation events.
* @param cb Callback function called when a new avatar marker is created
* @returns The callback function (for removal)
*/
static onAvatarMarkerCreated(cb: (args: AvatarMarkerEventArgs) => void): Function;
/**
* Subscribe to avatar marker destruction events.
* @param cb Callback function called when an avatar marker is destroyed
* @returns The callback function (for removal)
*/
static onAvatarMarkerDestroyed(cb: (args: AvatarMarkerEventArgs) => void): Function;
private static _onNewAvatarMarkerAdded;
private static _onAvatarMarkerDestroyed;
/** The network connection ID of the player who owns this avatar */
connectionId: string;
/** Reference to the avatar GameObject with optional XR flags */
avatar?: Object3D & {
flags?: XRFlag[];
};
/** @internal */
awake(): void;
/** @internal */
onDestroy(): void;
/**
* Check if this avatar marker represents the local player.
* @returns True if this avatar belongs to the local player, false otherwise
*/
isLocalAvatar(): boolean;
}