MCPcopy Create free account
hub / github.com/RodrigoHamuy/react-three-map / updateCamera

Function updateCamera

src/core/sync-camera.ts:39–58  ·  view source on GitHub ↗
(target: Object3D, projByViewInv: Matrix4)

Source from the content-addressed store, hash-verified

37}
38
39const updateCamera = (target: Object3D, projByViewInv: Matrix4) => {
40
41 target.position
42 .setScalar(0)
43 .applyMatrix4(projByViewInv)
44
45 target.up
46 .set(0, -1, 0)
47 .applyMatrix4(projByViewInv)
48 .negate()
49 .add(target.position)
50 .normalize()
51
52 fwd
53 .set(0, 0, 1)
54 .applyMatrix4(projByViewInv)
55
56 target.lookAt(fwd);
57
58}
59
60function calculateFar(c: number, d: number, near: number): number {
61 const numerator = d * (c - 1);

Callers 1

syncCameraFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected