1

I'm attempting to put a point at the edge of a perspective cameras initial visible field, but the point is significantly more inward than I'd expect.

Any idea how I can address this? The trig seems fairly straight forward but its possible I'm missing something

import * as THREE from "three";

let scene = new THREE.Scene();
let aspect = 300 / 200;
let camera = new THREE.PerspectiveCamera(45, aspect, 0.1, 1000);
camera.position.z = 10;

let renderer = new THREE.WebGLRenderer();
renderer.setSize(300, 200);
document.body.appendChild(renderer.domElement);

const pointMesh = new THREE.Mesh(
  new THREE.SphereGeometry(0.1),
  new THREE.MeshBasicMaterial({ color: 0xff0000 })
);
pointMesh.position.x =
  Math.tan(THREE.MathUtils.degToRad(camera.fov) / 2) * camera.position.z;

scene.add(pointMesh);

renderer.render(scene, camera);

point

erikreppel
  • 81
  • 1
  • 11

0 Answers0