跳转到内容

Physics3DPlugin

此内容尚不支持你的语言。

Defined in: physics3d/Physics3DPlugin.ts:43

index.ts

ESEngine 3D physics module — standalone Jolt WASM integration.

The flat world’s twin, entry for entry: esengine/physics hands a game the plugin, the world resource and the contact events, and until this file existed the solid world handed it none of them. Its components reached the main entry, so a scene could hold a body and a collider — and nothing a system could import could cast a ray at one or hear it land.

import { Physics3DPlugin, Physics3D } from 'esengine/physics3d';
app.addPlugin(new Physics3DPlugin('physics3d.js', { gravity: { x: 0, y: -9.81, z: 0 } }));
defineSystem([Res(Physics3D)], (queries) => {
const hit = queries?.raycast({ x: 0, y: 100, z: 0 }, { x: 0, y: -200, z: 0 });
});

new Physics3DPlugin(wasmUrl, config?, factory?): Physics3DPlugin

Defined in: physics3d/Physics3DPlugin.ts:50

string

Partial<Physics3DConfig> = {}

Physics3DModuleFactory

Physics3DPlugin

name: string = 'physics3d'

Defined in: physics3d/Physics3DPlugin.ts:44

Plugin.name

build(app): void

Defined in: physics3d/Physics3DPlugin.ts:57

App

void

Plugin.build


cleanup(): void

Defined in: physics3d/Physics3DPlugin.ts:100

Tear the world down, so a re-init does not inherit the last one’s bodies.

void

Plugin.cleanup