Add third-person camera collision resolution and update controller handling
This commit is contained in:
@@ -243,6 +243,16 @@ export class RuntimeHost {
|
|||||||
) ?? null,
|
) ?? null,
|
||||||
resolvePlayerVolumeState: (feetPosition) =>
|
resolvePlayerVolumeState: (feetPosition) =>
|
||||||
this.resolvePlayerVolumeState(feetPosition),
|
this.resolvePlayerVolumeState(feetPosition),
|
||||||
|
resolveThirdPersonCameraCollision: (
|
||||||
|
pivot,
|
||||||
|
desiredCameraPosition,
|
||||||
|
radius
|
||||||
|
) =>
|
||||||
|
this.collisionWorld?.resolveThirdPersonCameraCollision(
|
||||||
|
pivot,
|
||||||
|
desiredCameraPosition,
|
||||||
|
radius
|
||||||
|
) ?? { ...desiredCameraPosition },
|
||||||
setRuntimeMessage: (message) => {
|
setRuntimeMessage: (message) => {
|
||||||
if (message === this.currentRuntimeMessage) {
|
if (message === this.currentRuntimeMessage) {
|
||||||
return;
|
return;
|
||||||
@@ -355,7 +365,7 @@ export class RuntimeHost {
|
|||||||
});
|
});
|
||||||
this.activeController = null;
|
this.activeController = null;
|
||||||
this.firstPersonController.resetSceneState();
|
this.firstPersonController.resetSceneState();
|
||||||
this.orbitVisitorController.resetSceneState();
|
this.thirdPersonController.resetSceneState();
|
||||||
this.interactionSystem.reset();
|
this.interactionSystem.reset();
|
||||||
this.setInteractionPrompt(null);
|
this.setInteractionPrompt(null);
|
||||||
this.currentFirstPersonTelemetry = null;
|
this.currentFirstPersonTelemetry = null;
|
||||||
@@ -510,22 +520,12 @@ export class RuntimeHost {
|
|||||||
const nextController =
|
const nextController =
|
||||||
this.desiredNavigationMode === "firstPerson"
|
this.desiredNavigationMode === "firstPerson"
|
||||||
? this.firstPersonController
|
? this.firstPersonController
|
||||||
: this.orbitVisitorController;
|
: this.thirdPersonController;
|
||||||
|
|
||||||
if (this.activeController?.id === nextController.id) {
|
if (this.activeController?.id === nextController.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
|
||||||
this.activeController === this.firstPersonController &&
|
|
||||||
this.currentFirstPersonTelemetry !== null &&
|
|
||||||
nextController === this.orbitVisitorController
|
|
||||||
) {
|
|
||||||
this.orbitVisitorController.setFocusPoint(
|
|
||||||
this.currentFirstPersonTelemetry.feetPosition
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.activeController?.deactivate(this.controllerContext);
|
this.activeController?.deactivate(this.controllerContext);
|
||||||
this.interactionSystem.reset();
|
this.interactionSystem.reset();
|
||||||
this.setInteractionPrompt(null);
|
this.setInteractionPrompt(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user