/*! * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { Actor, ColliderEventType, ColliderGeometry, CollisionEventType, CollisionHandler, TriggerEventType, TriggerHandler } from '../..'; import { ColliderInternal } from './colliderInternal'; /** * Controls what the assigned actors will collide with. */ export declare enum CollisionLayer { /** * Good for most actors. These will collide with all "physical" things: other default actors, * navigation actors, and the non-MRE environment. It also blocks the UI cursor and receives press/grab events. */ Default = "default", /** * For actors considered part of the environment. Can move/teleport onto these colliders, * but cannot click or grab them. For example, the floor, an invisible wall, or an elevator platform. */ Navigation = "navigation", /** * For "non-physical" actors. Only interact with the cursor (with press/grab events) and other holograms. * For example, if you wanted a group of actors to behave as a separate physics simulation * from the main scene. */ Hologram = "hologram", /** * Actors in this layer do not collide with anything but the UI cursor. */ UI = "ui" } /** * Describes the properties of a collider. */ export interface ColliderLike { enabled: boolean; isTrigger: boolean; bounciness: number; staticFriction: number; dynamicFriction: number; layer: CollisionLayer; geometry: ColliderGeometry; eventSubscriptions: ColliderEventType[]; } /** * A collider represents the abstraction of a physics collider object on the host. */ export declare class Collider implements ColliderLike { private $owner; /** @hidden */ $DoNotObserve: string[]; private _internal; enabled: boolean; isTrigger: boolean; bounciness: number; staticFriction: number; dynamicFriction: number; layer: CollisionLayer; geometry: Readonly; /** @hidden */ get internal(): ColliderInternal; /** * The current event subscriptions that are active on this collider. */ get eventSubscriptions(): ColliderEventType[]; /** * @hidden * Creates a new Collider instance. * @param $owner The owning actor instance. Field name is prefixed with a dollar sign so that it is ignored by * the actor patch detection system. * @param initFrom The collider like to use to init from. */ constructor($owner: Actor, from: Partial); /** * Add a collision event handler for the given collision event state. * @param eventType The type of the collision event. * @param handler The handler to call when a collision event with the matching * collision event state is received. */ onCollision(eventType: CollisionEventType, handler: CollisionHandler): void; /** * Remove the collision handler for the given collision event state. * @param eventType The type of the collision event. * @param handler The handler to remove. */ offCollision(eventType: CollisionEventType, handler: CollisionHandler): void; /** * Add a trigger event handler for the given collision event state. * @param eventType The type of the trigger event. * @param handler The handler to call when a trigger event with the matching * collision event state is received. */ onTrigger(eventType: TriggerEventType, handler: TriggerHandler): void; /** * Remove the trigger handler for the given collision event state. * @param eventType The type of the trigger event. * @param handler The handler to remove. */ offTrigger(eventType: TriggerEventType, handler: TriggerHandler): void; /** @hidden */ toJSON(): ColliderLike; } //# sourceMappingURL=collider.d.ts.map