MCPcopy Create free account
hub / github.com/melonjs/melonJS / captureDepthCamera

Function captureDepthCamera

packages/melonjs/src/renderable/container.js:55–67  ·  view source on GitHub ↗

* Refresh the cached camera position from the active stage. Falls back * to (0, 0, 0) when no camera exists yet (e.g. early init, before any * stage has been set). Called just-in-time before `sortOn === "depth"` * runs its sort. The camera is a `Renderable` (Camera2d/Camera3d), so * `pos.z` is g

()

Source from the content-addressed store, hash-verified

53 * @ignore
54 */
55function captureDepthCamera() {
56 const stage = state.current();
57 const cam = stage?.cameras?.get("default");
58 if (cam) {
59 _depthCamX = cam.pos.x;
60 _depthCamY = cam.pos.y;
61 _depthCamZ = cam.pos.z;
62 } else {
63 _depthCamX = 0;
64 _depthCamY = 0;
65 _depthCamZ = 0;
66 }
67}
68
69/**
70 * Capture the world-space position of the given container into the

Callers 2

sortMethod · 0.85
sortNowMethod · 0.85

Calls 2

getMethod · 0.65
currentMethod · 0.45

Tested by

no test coverage detected