Skip to content

Raycasting frustum calculation for orthographic camera #150

@ka95708

Description

@ka95708

Describe the bug 📝

Related to #136
I think this calculation should also consider camera position

  private setEnds(camera: THREE.Camera) {
    if (camera instanceof THREE.OrthographicCamera) {
      const camPos = camera.position;
      const normalDotPos = this._n.normal.dot(camPos);
      this._n.constant = -(normalDotPos + camera.near);
      this._f.constant = -(normalDotPos - camera.far);
    } else {
      this._n.constant = camera.position.length();
      this._f.constant = Infinity;
    }
    this._f.normal = this._n.normal;
  }

Reproduction ▶️

No response

Steps to reproduce 🔢

No response

System Info 💻

System:
    OS: Windows 11 10.0.26200
    CPU: (28) x64 Intel(R) Core(TM) i7-14700
    Memory: 32.40 GB / 63.60 GB
  Binaries:
    Node: 22.20.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.3 - C:\Program Files\nodejs\npm.CMD
    pnpm: 10.18.3 - C:\Users\hao\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Chrome: 143.0.7499.193
    Edge: Chromium (144.0.3719.82)

Used Package Manager 📦

npm

Error Trace/Logs 📃

No response

Validations ✅

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a repository issue and not a framework-specific issue. For example, if it's a THREE.js related bug, it should likely be reported to mrdoob/threejs instead.
  • Check that this is a concrete bug. For Q&A join our Community.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions