OrbitControls: modifying the position and overall size of a 'guide' object

I am currently working on managing a 3D object that visually represents the target controls for easier understanding of rotation and zooming...

If you want to see an example, check out this sample I created with an AxisHelper indicating the target with consistent sizing. I have added comments in OrbitControls.js to explain each line.

While using the pan and zoom (right click and scroll) features, you may notice that the 'helper' has two issues:

  • The helper's position and scale are set after rendering, giving it an elastic appearance. Even if I move the position/scale updates into the scope.update() function, the issue persists.

  • The following function scales the helper to a constant size by calculating a World/View scale at a specified point (the control's target) from a unit vector. However, as you zoom in, the helper continues to grow which indicates this might not be the best solution:

    var point = new THREE.Vector3(1, 0, 0);
    point = point.applyMatrix4(scope.object.matrixWorld);
    var scale = point.distanceTo(scope.target);
    helper.scale.set(scale, scale, scale);
    

If you have any ideas on how to address these challenges, please feel free to share your insights...

Answer №1

As I work on a project using threejs, I've come to the realization that:

  1. Unfortunately, I'm unable to view the demo due to restrictions from my proxy server.
  2. In my opinion, it seems accurate...if the object helper is a mesh or a sprite added to the scene and the orbit controls zoom in, the camera gets closer to the objects while their dimensions remain unchanged.

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

Issue with Node.js: Modifications to route settings are not reflected

It's puzzling - the changes I make to my route settings in the MEAN environment, with Node v0.12.2 and express 4, don't seem to have any effect! Specifically, when I use ".sendfile()" to respond to client requests. app.get('/', functio ...

Is there a way to display an alert using JavaScript that only appears once per day?

I've created a website that displays an alert to the user upon logging in. Currently, the alert is shown each time the user logs in, but I'm looking to make it display only once per day at initial page loading. How can I achieve this? Below i ...

Surprising Results when Using getBoundingClientRect()

Check out this code on CodePen In my current project, I'm attempting to position the footer div at the bottom of the page in such a way that it aligns with the maximum value of the bottom coordinates of both the menu and content divs (Math.max(menu, ...

Utilizing Node.js and Node-Postgres: Organizing Database Queries in Models

In order to enhance the efficiency of my code, I am looking to modularize my queries by organizing them into functions with appropriate names for their tasks. Instead of cluttering up the req, res functions (controllers), I aim to encapsulate them in a se ...

React, Redux, Thunk - the trifecta of powerful

After spending a considerable amount of time struggling with this particular piece of code, I have scoured online resources such as Stack Overflow and the documentation, but there is still something that eludes me... The code in question revolves around t ...

Can one showcase a php content using an ajax event?

I’m having trouble asking the right question because I’m not sure what I’m doing. I have a form that includes a default PHP script that creates three different lines: <form method="GET" name="NewDeliveryNote" action="ItemPosts_INSERT.php"> < ...

How to declare WinJS.xhr as a global variable in a Windows 8 Metro app

Currently, I am developing a Windows 8 Metro app and facing an issue with a hub page. The problem arises when pushing data dynamically from an XML API using two WinJs.xhr("url") calls; one for headings and the other for section datas. When merging both W ...

Is there a way to pass the ng-repeat value or ID to my dynamically appended element? If so, how can I achieve

I am working on a project where I have a table with 5 data entries retrieved from a select query. My goal is to extract the ng-repeat value and ID, then transfer it to another element. As a beginner in Angularjs and HTML, I would greatly appreciate any ass ...

Wait until the ajax request is fully completed before executing the javascript function

Is there a way to ensure that a JavaScript function is only executed after a jQuery ajax call has fully completed, including the success and error events? In other words, I want the function to run only after the incoming data from the ajax call has been s ...

Utilizing Laravel for Making Ajax Calls to Controller

I am a beginner in using Laravel and I am trying to create an API with Laravel using AJAX calls. However, when I make the AJAX call, the URL appears to show an invalid server path. Below is my code: My Route file : Route::get("a/b","AController@c"); My ...

Guide on utilizing mongoose for handling multiple increment operations

Currently, I am developing a program that tracks different "accepts" and "denies". In this project, I am utilizing the findOneAndUpdate function from mongoose. However, I am encountering some issues with achieving the desired functionality. The data I am w ...

Issues with AngularJS edit functionality for records not functioning as expected

I have implemented a feature on my page where users can add objects to an array. These objects are then displayed on the page along with links for editing each item in the array. Each added item is assigned a primary key, allowing users to edit it later e ...

Encountering an issue while attempting to test geolocation functionality in the web browser

I've been working on integrating the geolocation API into my app and came across a suitable resource at the MDN website. However, when I attempted to test for the existence of the geolocation object in the browser, I encountered this error: Server Err ...

Learn how to show the current page number using React Js with the help of material-ui's

Take a look at the code snippet below from my App.js Component: const App = () => { const [workstations, setWorkstations] = useState([]); let [page, setPage] = useState(1); const PER_PAGE = 1; useEffect(() => { loadWorkstations(); }, [] ...

Executing an AJAX request in the onsubmit event of a form results in the form submission proceeding even when return false is

I am facing an issue with a form that I intend to use only for an AJAX call. The AJAX call is triggered on submit in order to utilize the auto-check feature for required fields. Despite returning false on submit, the form still submits. Surprisingly, when ...

Can you explain the contrast between using require('d3') and require('d3-selection')?

While working on a nodejs application with javascript, I encountered an interesting issue. In my code, I am passing a d3 selection to a function as shown below. // mymodule.js exports.myfunc = function(ele){ if(ele instanceof d3.selection){ // do so ...

Show a picture upon hovering the button

Welcome to my website. My goal: Show an image when a user hovers over the links. I must be making some silly error, but I can't pinpoint it. This is what I've attempted so far: HTML <ul class="nm"> <li><a href="#">Cork& ...

An issue occurred during payment processing with NodeJS, ExpressJS, and Stripe that resulted in a Parse Error

https://i.sstatic.net/GXLaV.png Functioning well on: Windows (Windows 10, Node v13.10.1, NPM 6.14.4) Encountering error on: Linux (Ubuntu 18.04, Node v12.16.2, NPM 6.14.4) Whenever I make a payment using the Linux web server using either Stripe live key ...

Combine the initial element of one array with the initial element of another array in JavaScript

Is there a more efficient way to concatenate the first item of one array with the first item of another array in JavaScript, and automate console.log for each pair? Check out the code snippet below: $("button#search").on("click", function(){ var inputVa ...

Annoying div unexpectedly wrapping content after using appendTo

Greetings, esteemed members of the SO community, I am here once again with a question that requires your assistance. Context: I am currently working on a grid system that allows users to drag and drop items onto specific grid fields. When the grid is re ...