Add teleportTo method and reset interaction system in runtime host

This commit is contained in:
2026-03-31 06:17:31 +02:00
parent 0b9aafd2ca
commit 0174b5c8d6
2 changed files with 13 additions and 0 deletions

View File

@@ -138,6 +138,18 @@ export class FirstPersonNavigationController implements NavigationController {
this.publishTelemetry();
}
teleportTo(feetPosition: Vec3, yawDegrees: number) {
this.feetPosition = {
...feetPosition
};
this.yawRadians = (yawDegrees * Math.PI) / 180;
this.pitchRadians = 0;
this.verticalVelocity = 0;
this.grounded = false;
this.updateCameraTransform();
this.publishTelemetry();
}
private updateCameraTransform() {
if (this.context === null) {
return;

View File

@@ -119,6 +119,7 @@ export class RuntimeHost {
}
this.activeController?.deactivate(this.controllerContext);
this.interactionSystem.reset();
this.activeController = nextController;
this.activeController.activate(this.controllerContext);
}