Collaboration between Projector and OrthographicCamera

Is it feasible to utilize Projector and Ray in conjunction with OrthographicCamera?
I have combed through resources but can't seem to find any examples or documentation. Additionally, my Camera is not positioned in the center of the screen.

camera = new THREE.OrthographicCamera(0, width, 0, height, orthonear, orthofar);
This implies that the top left corner will be (0, 0). Therefore, I am doubtful that the following code functions correctly.
mouse.x = (event.clientX / width) * 2 - 1;

mouse.y = -(event.clientY / height) * 2 + 1;

How can I effectively use Projector and Ray with an OrthographicCamera, or are there alternative methods for interacting with objects?

Answer №1

Here is the original example:

To modify the camera to Orthographic, utilize the controls provided by DAT.GUI on the right side.

A small excerpt from the code:

ray = projector.pickingRay( mouse2D.clone(), camera ); 
var intersects = ray.intersectObjects( scene.children );

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Troubleshooting Node.js - MongoDB document removal issue

I am attempting to delete all documents from a collection that contain a field named uuid with values matching the $in operator along with an array I provide. However, for some reason the deletion is not functioning as expected. Below is the code snippet a ...

Interactive image grid with adjustable description field per image upon selection

My goal is to create a grid of images with a single text field below the grid. This text field should display the description of the image that was last clicked. The grid is implemented using floating divs within a main div, as shown in the code snippet be ...

Having trouble launching the freshly developed Angular app

I'm encountering an issue with my newly created app - I can't seem to launch it. Error: The loader “C:/C#/Angular/my-app/src/app/app.component.css” is not providing a string as expected. https://i.sstatic.net/6Xjwd.png https://i.sstatic.ne ...

A guide on crafting OR queries in Elasticsearch using Node.js

I currently have a document structured like this: Sample document, [ { "_index": "xpertdox", "_type": "disease", "_id": "Ectopic Heartbeat", "_score": 24.650267, "_source": { "category": "Condition", "name": "Ectopic ...

Removing data from every page of a table with the Datatable plugin

Currently, I am facing an issue with a table of data that I am handling using the Datatable plugin. My goal is to clear the table upon clicking a button and then redraw it with updated values received via an ajax call. The problem arises when trying to del ...

Using API calls to update component state in React-Redux

I am currently working on setting up a React application where clicking on a map marker in one component triggers the re-rendering of another component on the page. This new component should display data retrieved from a database and update the URL accordi ...

Display an image when the iframe viewport is reduced in size by utilizing media queries

I am looking to showcase a demo.html page within a 400px square iframe. When the viewport is smaller than 400px, I want demo.html to only display an image. Then, when clicking on that image in demo.html, the same page should switch to fullscreen mode. Sim ...

Can TrackballControls be used to spin an object around?

Can an object be rotated using TrackballControls instead of the camera? Check out this link to learn more. ...

Connecting JavaScript and jQuery scripts

Help needed! I am a beginner in the world of jQuery and JS. Unfortunately, my JS/jQuery code is not running and I can't figure out why. Can someone please take a look at my HTML and guide me on what might be causing the issue? Do I need to add some ad ...

Is there a way to identify the top five elements that are most frequently occurring in the array?

I've successfully found the element that appears the most in an array, but now I'm facing a new challenge where I need to identify the top 5 elements that appear most frequently. Here is the array: [ "fuji", "acros", &q ...

Using Angular2 in conjunction with the simpleheat plugin

I've been attempting to integrate the NPM plugin Simpleheat () into my Angular2 app, but unfortunately, the heatmap is not rendering even though everything appears to be set up correctly. You can find the full repository with the issue here: https:// ...

Is there a way to eliminate the filter icon from the material-table component?

I'm looking to customize my table by removing the filter icons and having blank input boxes instead. I've tried using the column prop filterCellStyle, but the icon can't be accessed since it's inline styling. import React, { Children ...

Traverse Through Collection of Vue Elements

I am working on creating an array of Vue Components based on a configuration file containing various UI sections to display; const config = [ 'summarySection', 'scoreSection', 'educationSection' ] I am attempting to ma ...

Proper management of setTimeout in an Angular application

I am working on a one-page web application where the main component's ngOnInit() function triggers a recursive function called loopDoSomething() using setTimeout: ngOnInit(): void { // Perform some operations this.loopDoSomething(); } loopDoSome ...

Encountering difficulties with updating customer information in postgreSQL

I am attempting to perform CRUD operations using pg-promises and stored procedures in PostgreSQL. Here is my code: controller.js: const db = require("./../index.js"); exports.getAllData = async (req, res, next) => { try { const data = ...

What is the best way to display table rows for a specified date range?

I am working with a table and need to display only the rows that fall between two specific dates. <table id ="Table"> <thead> <tr> <th>Date</th> <th>Name</th> <th>Desc</th> </tr> </thead> ...

Sending an associative array to Javascript via Ajax

Learning a new programming language is always a great challenge. Can someone guide me on how to efficiently pass an associative array to JavaScript using AJAX? Below is a snippet of code from server.php: $sql = "SELECT Lng, Lat, URL FROM results LIMIT ...

Getting rid of the Horizontal Scroll Bar

Having trouble with a persistent horizontal scrollbar in the "section3__container" container despite attempts to adjust size and overflow settings. Need assistance in removing this unwanted feature. <html lang="en"> <head> <m ...

The submission of the Ajax form is malfunctioning

My attempt to load the php code without refreshing the page is failing with my Ajax code. What could be causing the issue? I prefer not to use jquery or other frameworks. Do you think the problem lies in my javascript code? Should I resort to using jquery ...

Holding off on routing the pathName through the router until the next-page-transitions have been completed

In my current setup, I have two distinct elements at play. Using the code snippet below: className={router.pathname.startsWith("/pagename") ? "menu-active" : ""} I am able to apply the menu-active class to the pagename naviga ...