A role requiring coordinates x, y, and z with significant values

http://jsfiddle.net/eho5g2go/

 var offset=10000000;
...
 camera.position.set(offset,offset,400);
 mesh.position.set(offset-300,offset,0);
 camera.lookAt(mesh.position);
...
animate();

The "offset" variable is crucial for determining the camera and mesh positions in the code snippet provided. Setting it to 100000000 leads to unusual behavior during animation, while a value of 10000000 ensures everything runs smoothly.

This raises the question: how can we accurately specify object positions with coordinates exceeding 100000000?

Answer №1

The values provided are not as expected, indicating a potential classic floating point precision issue.

Computers struggle with accuracy when dealing with extremely large or small numbers in floating point calculations.

To address this, it would be beneficial to adjust the scale of your scene to maintain more reasonable figures.

For further information, refer to

Edit: Upon reviewing , it is evident that the choice of near and far values for the projection camera matrix can impact precision errors. To minimize these errors, keep the near and far values close together.

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

Fetch JSON information from various servers/domains through ajax requests

I am attempting to retrieve JSON data from a different server/domain. My expectation is that the code below should trigger a success alert, but instead, I am getting an error alert $.ajax({ url: "http://xxxx.com/zzzz", ...

Working with jQuery.ajax Function Calls in Array Filter Operations with Javascript

My knowledge of AJAX calls is limited, so I am unsure about how they interact with array filtering using A.filter(). The array in question is used to populate a template synchronously. // An event triggers a function to filter a list on the page. // The f ...

Retrieve data from controller using jQuery Ajax

I am in need of assistance with my HTML form and controller interaction. I require a Boolean result from the controller based on user input. Here is an overview of my current form: <div id="temp"></div> @using (Html.BeginForm("Re ...

How to continuously stream and display an actively updating log text file from a server in real-time onto a web textbox, eliminating the need for webpage

There is a log file in notepad format with values like this: 11.23445646,56.3456578954, 10.23445646,26.3456578954, and 16.23445646,-46.3456578954. I want to retrieve the data from the server and display it in a website textbox. The first value, which is ma ...

Modify the information on a page by clicking a button on a different page

I'm currently working on the design of a website that consists of two pages. The first page features a button, which when clicked should remove the hidden class from an element on the second page. I have searched extensively for a solution, but so far ...

Discovering the Power of IONIC with JSON Data Suggestions

Which method is more effective for handling JSON data, especially when working with IONIC? var quizs = [ {id: 1, question: '1.jpg', desc: 'What color is displayed here', answer: 'blue, green, ...

Guide on parsing a JSON object in JavaScript

One issue I'm facing is that my controller method returns a string representation of a jsonArray using the jsonArray.toString() function. Below is the corresponding ajax method: function loadPropertyFile(url) { $.ajax({ type: "GET", url: url, ...

Issues with NodeJs Express routes execution

After testing, I found that only the default route "/" is working in my code. Many similar issues involve routers being mounted to paths like "/auth" or "/user". Even when I tested the default router mounted to "/", it still isn't functioning properly ...

Updating an Angular directive with dynamically added ng-module and ng-change attributes

Can someone check if I'm on the right track? Preamble: I've created a Typeahead class that fetches data and keeps it within itself. The class has the following structure: input: stores the search text. list: stores the results. change: a funct ...

Creating a versatile menu component: A step-by-step guide

One of my current projects involves designing a menu screen component that must be user-friendly and easily customizable. The component will consist of various options displayed in list form. const options = [ { text: 'Option 1', }, { ...

Eliminate redundant tags using jQuery

I have a code snippet that I need help with. I want to check for duplicates and if found, display an alert stating that it already exists so users can't insert the same word/tag again. Can someone please assist me? <div id="tags"> <span>a ...

Javascript functions fail to execute as intended

I have a project called calc, which includes various functions such as init. Within this project, there are three buttons that I am adding to the div using jquery. When a user clicks on any of these buttons, it should trigger the inputs function. Based on ...

Encountering a SyntaxError while trying to load a gltf file using Three.js in a React

I'm currently in the process of integrating a 3D model into a website. Everything went smoothly when I used a 3D model from a website, but when I attempted to use my own model, I encountered this console error: SyntaxError: "JSON.parse: unexpected cha ...

Handling empty values in JSON data when sending it to the controller through AJAX

Attempting to transmit the following JSON data from View to Controller: { "allselected": false, "selectedIds": ["", "all"], "targetControl": "Studieniva", "targetSource": "studienivalist", "dependency": [{ "name": "ShopNo", ...

Preventing scrolling in jQuery UI Draggable when using flexbox

In my project, I am looking to organize a container using jQuery UI draggable/droppable feature. Since the elements in my list are arranged in a straight horizontal line, I have utilized display: flex. This arrangement works well when adding new items to ...

Finding Text Between Two Distinct Strings Using Regular Expressions in JavaScript

I am currently utilizing AJAX technology. My approach involves sending a GET request that retrieves a raw HTML string representing the content of a webpage. I am grappling with the challenge of isolating all elements enclosed between div tags: <div ro ...

Utilize Angular functions in every controller in your application

Currently, I have important functionality code within app.run(function... in Angular: app.run(function($rootScope, $window) { // Obtain window dimensions $window.width = angular.element($window).width(); $window.height = angular.element($window).he ...

Restrict access to PHP scripts to only be allowed through AJAX requests

Within my content management system (CMS), I have a specific page that fetches various mini-interfaces from PHP files located in an /ajax directory using AJAX. I am wondering if there is a way to restrict access to these files solely through AJAX requests ...

Troubleshooting problem in AngularJS involving ng-repeat and storing user input

I am currently working on developing a system similar to Facebook's post/like/comment feature. I have successfully implemented the posts and likes functionality, but I am facing some challenges with comments. The issue lies in the controller code and ...

A viewless Angular 2 component

Is it feasible to utilize Angular 2 without the need for a template or an @View? I am exploring alternative methods akin to the example shown below: Angular 1 index.html <div ng-controller="appcontroller"> <div ng-class="{active: isActive()}"& ...