Utility and polishing + bag fixes
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
InstallBanner,
|
||||
} from "@hitplay/playable_template";
|
||||
import { CameraC } from "../controllers/CameraC";
|
||||
import { CameraFollowC } from "../controllers/CameraFollowC";
|
||||
import { ThreeC } from "../controllers/ThreeC";
|
||||
import { Color } from "three";
|
||||
import { Vec3 } from "cannon-es";
|
||||
@@ -114,17 +115,19 @@ export const beforeResourcesLoadedCb = () => {
|
||||
break;
|
||||
|
||||
default:
|
||||
if (
|
||||
[
|
||||
"camera_fov_p",
|
||||
"camera_position_p",
|
||||
"camera_rotation_p",
|
||||
"camera_fov_l",
|
||||
"camera_position_l",
|
||||
"camera_rotation_l",
|
||||
].includes(variable)
|
||||
) {
|
||||
// The camera's config is split between two owners on purpose:
|
||||
// FOV lives on the camera itself (CameraC), while the rig —
|
||||
// offset and angle — belongs to CameraFollowC, which is the only
|
||||
// thing allowed to write camera.rotation. Routing each field to
|
||||
// its own owner is what keeps them from stomping each other.
|
||||
if (["camera_fov_p", "camera_fov_l"].includes(variable)) {
|
||||
CameraC.setCamera(window.screenSize.portrait);
|
||||
} else if (
|
||||
["camera_position_p", "camera_position_l", "camera_rotation_p", "camera_rotation_l"].includes(variable)
|
||||
) {
|
||||
// No-ops safely before the scene exists: CameraFollowC reads
|
||||
// the same config again in its own init().
|
||||
CameraFollowC.applyRigFromConfig();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user