What steps are needed to adjust the location of a vertex within a specified threejs.Box3?

My goal is to create a box, manipulate one of its vertices through geometry operations, and then display it on the screen.

var anchor = new THREE.Vector3( 300, 300, 3 );
var cursor = new THREE.Vector3( 500, 550, 50 );

var box2       = new THREE.Box3( anchor, cursor );
var box2Helper = new THREE.Box3Helper( box2 );

box2Helper.geometry.vetices[0] = new THREE.Vector3( 20, 20, 20 );
box2Helper.geometry.verticesNeedUpdate = true;

scene.add( box2Helper );

The code functions properly even without those two geometry lines.
Is there a method in the geometry class to change the position of a specific vertex of the box?

Answer №1

There seems to be some misunderstanding about the functionality of the Box3 class here... It primarily serves as a 3D bounding box. If you want to create a deformable box with vertices, you should consider using something like new THREE.Mesh(new THREE.BoxGeometry(1,1,1), new THREE.MeshStandardMaterial()).

Afterwards, you can make modifications to the mesh.geometry.vertices as needed.

It's important to note that THREE.Box3 is more of a utility class designed for representing bounding boxes in certain scenarios such as frustum culling.

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

Tips for utilizing two renderCell functions in a datagrid from Material UI without encountering duplication or repetition

Utilizing Material UI, I have designed a table to showcase my data. In this setup, I am required to use renderCell for two specific properties: 'level by user' and 'level by referent'. Issue: The problem arises when Material UI displa ...

Managing "unprocessed information" in a Node.js environment and transferring the information through a Node Express endpoint

Currently, I am in the process of making an API call to retrieve a file using axios: async function fetchData() { const configuration = {}; // { responseType: 'stream'}; const { response } = await axios.get(URL, configuration); c ...

What is the method for accessing extra parameters in the signIn() callback function in [...nextauth]?

As per the Next Auth documentation, it is possible to pass extra parameters to the /authorize endpoint using the third argument of signIn(). The examples provided are: signIn("identity-server4", null, { prompt: "login" }) // always ask ...

Use Javascript or Jquery to dynamically change the background color of cells in HTML tables based on their numerical

I am working with a collection of HTML tables that contain numbers presented in a specific style: <table border="1"> <tr> <th>Day</th> <th>Time</th> <th>A</th> <th>B</th> &l ...

How to efficiently update a nested array within the state of a React

Although the onChange function is working as expected, I am facing issues with updating the features in the state. Despite numerous attempts, I haven't been able to find examples similar to what I'm trying to achieve, so I decided to seek help. ...

Tips for sorting through an array containing various types of data

I'm dealing with an array structured like this: const AllFiles = [ {name: "ExistingFile1", mimetype: "image/jpg", size: "500"}, [ File, // This is the New File itself (see File API) {name: "NewFi ...

In JavaScript, split each element in an array into individual elements

Is there a way to split elements separated by commas into an array in JavaScript? ["el1,el2", "el3"] => ["el1", "el2", "el3"] I am looking for a solution to achieve this. Can you help me with that? ...

When users visit my contact HTML page, they are redirected to the contact PHP page, but unfortunately, the email is

I am currently facing an issue with my contact form. After filling out the form and hitting the "send" button, it redirects to the contact.php page but fails to send an email or work as intended. Can someone please assist me and identify what's causin ...

Implement a logging system to track and record data from both incoming requests and outgoing responses on a server powered by Express and Node.js

Is there a way for my server to log the response and request data when posting to another server? Thank you. const request = require('request'); postToIotPlatform = function postToIotPlatform(req, res, next) { var formData = JSON.stringify( ...

Transmitting FormData from Angular to a .NET MVC Controller

Here's my perspective: <form ng-submit="onFormSubmit()"> <div class="form-group"> <label for="Movie_Genre">Genre</label> @Html.DropDownListFor(m => m.Movie.GenreId, new SelectList(Model.Genres, "Id", "Na ...

Having trouble importing a variable from a precompiled library in TypeScript JavaScript

Here is the content of my package.json file: { "name": "deep-playground-prototype", "version": "2016.3.10", "description": "", "private": true, "scripts": { "clean": "rimraf dist", "start": "npm run serve-watch", "prep": "browserify ...

Tips for simulating the $timeout service with sinon?

I am looking to write a unit test for a method within an Angular controller that uses the $timeout service. However, I have been advised not to use inject in this scenario. Therefore, I need to mock $timeout on my own. Can someone guide me on how I can a ...

Creating recurring shapes in the Canvas element

I just joined this platform and I'm trying to create an animation using canvas. My goal is to redraw a circle every 2 seconds with a canvas reset in between. The circle should appear randomly within the canvas, which I was able to accomplish. However, ...

Navigating within two containers using the anchorScroll feature in AngularJS

I am trying to create a page with two columns of fixed height. The content in each column is generated using ng-repeat directive. Is it possible to implement scrolling within each column to a specific id using AngularJS? Code <div> Scroll to a p ...

Error occurred during Apple Login using Next_Auth: OAuthCallback issue

Attempting to log in with Apple using NextAuth. Authentication is successful, but it redirects to /?error=OAuthCallback. The URL being used is: https://appleid.apple.com/auth/authorize?client_id=com.wheeleasy.org&scope=name%20email&response_type= ...

I am interested in changing the sitecore search facet filter from allowing multiple selections to only allowing a single

I have successfully implemented the Sitecore search widget and the result list is working as expected. However, I encountered an issue with the filter functionality using facets. By default, it supports multiple filters but my requirement is to have singl ...

Frozen Blanket: Modifying Particle Velocity

I need assistance adjusting the particle speed in this snowfall animation script. I'm having trouble locating the specific values that control the "Falling Speed." The current speed of the falling particles is too fast, and here is most of the code sn ...

Using Paper Checkbox to Toggle the Visibility of a Div in Polymer

Having experience with Meteor, I typically used JQuery to toggle the display of a div along with paper-checkbox: HTML: <paper-checkbox name="remoteLocation" id="remote-chk" checked>Remote Location</paper-checkbox> <div id="autoUpdate" clas ...

Combine two functions into a single one to streamline and avoid overlap

Recently, I set up an exclusive checkbox feature within my HTML code. This feature includes 2 <input> elements along with two <button> elements that are also exclusive and have black/white color options based on the input they are associated wi ...

Ways to grow your circle of friends on Facebook on a daily basis

Exploring different methods to retrieve a list of my Facebook friends on a daily basis, I embarked on a journey to find the most efficient way to achieve this goal. Initially, I opted for creating a selenium webdriver script. This involved opening a web b ...