Unusual bounding box behavior observed in three.js

Having an issue with my three.js application. I created a cube and its bounding box, but when trying to access the computed bounding box (helper_bbox.geometry.boundingBox), I found it was returning a value of null, despite being correctly rendered on screen. Oddly enough, the bounding sphere (

helper_bbox.geometry.boundingSphere
) is accessible. Can anyone shed some light on why this might be happening? Is there a specific method that needs to be called to retrieve the coordinates of the bounding box points? Appreciate any insights.

Answer №1

Calculating geometry bounding boxes is not a default feature, unless needed for other internal processes. To manually trigger the computation of the box and examine it, you can use the following code:

object.geometry.computeBoundingBox();

console.log( object.geometry.boundingBox );

Updated for three.js r.87

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

Trigger function when an option is chosen from the jQuery UI autocomplete suggestion list

Hello, I have implemented an autocomplete feature in my code which is functioning properly. However, I am facing an issue where the desired function (doSomething()) is not triggered when a user clicks on an option from the autocomplete list. The function o ...

How to retrieve a value from PHP using Ajax?

I am struggling to implement ajax for adding a div to display an error message. Despite my efforts, I keep receiving null as the error message instead of the expected value. The occurrence of null is traced back to <?php echo json_encode($_SESSION[&ap ...

JavaScript generates a series of checkboxes dynamically, all lined up in a single row

I am currently working on a script where I iterate over objects and aim to display the text of each object on a new line in the list format, along with a checkbox next to it. Despite successfully printing everything with a checkbox, the issue I am facing i ...

What is the best way to use jQuery's $get() function to import a text file from an external website into a JavaScript

Once the button is clicked within the script below, it will load the contents of the file "" and present it on the screen. How should the .get() function syntax be correctly written to fetch data from an external website and place it in #content? <!DO ...

Uh-oh! The module "side-channel" cannot be found. An error occurred in the loader with code 936 when trying to run the command "npm start"

During the execution of npm start to view my React app, I encountered the following error: > react-scripts start node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module 'side-channel' Require stack: - C:\Users&bs ...

"The onkeydown event dynamically not triggering for children elements within a parent element that is contentEditable

Can anyone offer some insights into why this code isn't functioning as expected? My goal is to attach the listener to the children elements instead of the body so that I can later disable specific keystrokes, such as the return key. <!DOCTYPE html ...

Twitter's Web Intents feature is giving me the disappointing message "We're sorry, but that page cannot be found."

After reviewing the Twitter Web Intents documentation, I believed I could create specific links that would successfully open a Web Intents window to Twitter. While the Web Intents window did open as expected, I encountered an error message stating "Sorry, ...

Is it possible to assign multiple ID's to a variable in jQuery?

I am currently using a script for a slider known as Slicebox, and in order to have different image sizes for mobile and desktop views, I need to duplicate the feature on my website. Although it's not ideal, I really like this slider and want to explo ...

Mastering the Art of Rotating Objects Using Three.js World Axis

How can I retrieve the rotation values of an Object3D based on world axes like: roation.x, rotation.y, rotation.z Currently, when I use object.rotation.x I receive the rotation value relative to the object's local axes. Appreciate any help! ...

adjusting the line height within a selection box

What happens when setting line-height: 40px; for the option elements within a select box? <select class="select_box"> <option value="" disabled="disabled" style="display: none;">Categories</option> <option>10</option&g ...

Using vuetify's v-autocomplete component with the options to select all and clear items

I am trying to incorporate a "Filter by values" feature in my application similar to Excel or spreadsheets. However, I am facing difficulty with implementing the 'Select all' and 'Clear' button in v-autocomplete. <v-col> < ...

Consistent integration into React component

I'm currently working on an application using the React library, but my current challenge lies within JavaScript ES6 itself. Within a component (page) that I've created, I have implemented a custom Floating Action Button (FAB): class Page exten ...

Postpone reloading automatically if a division is in view

I endeavored to develop a small project aimed at monitoring flights passing over my vicinity. Utilizing the flight-radar24 API python package, I managed to extract the necessary data. Subsequently, I designed a systemd service to execute my python script ...

Exploring jQuery AJAX Attributes during ajaxStart and ajaxStop event handlers

With my project consisting of over 40 ajax webservice calls, I am looking to incorporate additional debugging features. One such feature is a timing method which I have already developed using my Timer class/object in Javascript. I'm seeking assistan ...

Convert ViewBag into a JSON array in order to create a bar chart in a .NET MVC application

I am struggling to convert ViewBag into a Json array in order to create a chart within the .Net MVC framework. Despite attempting to parse the Json data based on solutions from previous queries, the chart is not displaying anything. Here is my code: Contr ...

Error Encountered in MERN Stack Development: TypeError Thrown Due to Inability to Convert Undefined

Currently, I am following the MERN Stack, Front To Back Course by Traversy Media. I am in the process of setting up the login functionality for the application. Despite ensuring that my code matches his exactly, I am encountering an error: TypeError: Canno ...

Instead of overlapping the content, my overlay shifts the entire page downwards

I am looking to create a dynamic user experience where clicking on an image triggers a <div> overlay that darkens the background. However, instead of simply appearing over the current screen, I want the overlay to push everything else beneath it. Be ...

An error with jQuery occurred in the client's post response, resulting in a 400 POST HTTP/1.1 error

I am struggling to identify the issue with my code, especially since I'm not very familiar with jQuery. The goal is to create an HTML form for storing car data based on this template: https://i.sstatic.net/u40nG.gif The source code for the HTML form ...

What is the best way to reduce the size of a Base64/Binary image in Angular6

I utilized the Ngx-Webcam tool to capture images from my camera. My goal is to obtain both high quality and low quality images from the camera. Although this library provides me with Base64 images, it offers an option to reduce the size using imageQuality ...

Angular data binding is a concept that continues to elude me

After spending countless hours experimenting with variations of this code, it remains a mystery to me why one version works while the other fails. The situation is as follows: I am attempting to display a list of registered users retrieved from a database ...