UNPKG

mylingo3d

Version:

Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor

88 lines (87 loc) 3.78 kB
import { Object3D, Vector3 } from "three"; import type { Body } from "cannon-es"; import { Cancellable } from "@lincode/promiselikes"; import { Point3d } from "@lincode/math"; import SimpleObjectManager from "../SimpleObjectManager"; import IPhysicsObjectManager, { PhysicsGroupIndex, PhysicsOptions, PhysicsShape } from "../../../interface/IPhysicsObjectManager"; import StaticObjectManager from "../StaticObjectManager"; import MeshItem from "../MeshItem"; import PhysicsUpdate from "./PhysicsUpdate"; export default class PhysicsObjectManager<T extends Object3D = Object3D> extends SimpleObjectManager<T> implements IPhysicsObjectManager { protected _mAV?: Point3d; private getMAV; get maxAngularVelocityX(): number; set maxAngularVelocityX(val: number); get maxAngularVelocityY(): number; set maxAngularVelocityY(val: number); get maxAngularVelocityZ(): number; set maxAngularVelocityZ(val: number); protected _mV?: Point3d; private getMV; get maxVelocityX(): number; set maxVelocityX(val: number); get maxVelocityY(): number; set maxVelocityY(val: number); get maxVelocityZ(): number; set maxVelocityZ(val: number); protected cannonBody?: Body; applyForce(x: number, y: number, z: number): void; applyImpulse(x: number, y: number, z: number): void; applyLocalForce(x: number, y: number, z: number): void; applyLocalImpulse(x: number, y: number, z: number): void; applyTorque(x: number, y: number, z: number): void; get velocity(): Point3d; set velocity(val: Point3d); protected positionUpdate?: PhysicsUpdate; protected rotationUpdate?: PhysicsUpdate; private refreshCannon; protected _noTumble?: boolean; get noTumble(): boolean | undefined; set noTumble(val: boolean | undefined); protected _slippery?: boolean; get slippery(): boolean | undefined; set slippery(val: boolean | undefined); protected _mass?: number; get mass(): number | undefined; set mass(val: number | undefined); protected _physicsGroup?: PhysicsGroupIndex; get physicsGroup(): PhysicsGroupIndex | undefined; set physicsGroup(val: PhysicsGroupIndex | undefined); protected _ignorePhysicsGroups?: Array<PhysicsGroupIndex>; get ignorePhysicsGroups(): PhysicsGroupIndex[] | undefined; set ignorePhysicsGroups(val: PhysicsGroupIndex[] | undefined); protected _physicsShape?: PhysicsShape; get physicsShape(): PhysicsShape; set physicsShape(val: PhysicsShape); protected bvhVelocity?: Vector3; protected bvhOnGround?: boolean; protected bvhRadius?: number; protected bvhHalfHeight?: number; protected bvhMap?: boolean; protected bvhCharacter?: boolean; protected initPhysics(val: PhysicsOptions, handle: Cancellable): void; protected _physics?: PhysicsOptions; get physics(): PhysicsOptions; set physics(val: PhysicsOptions); protected _gravity?: boolean; get gravity(): boolean; set gravity(val: boolean); intersects(target: StaticObjectManager): boolean; get x(): number; set x(val: number); get y(): number; set y(val: number); get z(): number; set z(val: number); get rotationX(): number; set rotationX(val: number); get rotationY(): number; set rotationY(val: number); get rotationZ(): number; set rotationZ(val: number); lookAt(target: MeshItem | Point3d): void; lookAt(x: number, y: number | undefined, z: number): void; placeAt(object: MeshItem | Point3d | string): void; lerpTo(x: number, y: number, z: number, alpha: number): void; moveTo(x: number, y: number | undefined, z: number, speed: number): void; }