Drag multiple objects in three.js

I created a 3D space using Three.js, similar to the example shown here.

My goal now is to allow users to select and drag multiple objects simultaneously.

I'm questioning whether I can modify the existing example to achieve this or if I need to start from scratch with a different approach?

Appreciate any insight provided. Thank you.

Answer №1

One method is to utilize the rectangular boundaries of the objects being chosen. By casting a ray onto a cube that aligns with the overall combined boundary, you can then manipulate this large box and transfer the positional adjustment to the selected items.

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

Streaming videos using Flask with a custom template

After successfully implementing the DWA path planning algorithm in C with Python bindings, I have decided to create a web application demo. The concept involves a "robot" following the mouse using DWA, while allowing users to draw walls for objects. My ini ...

How can I allow users to select multiple files with just one input?

Currently, I am able to retrieve a single file from a single input using the following code: $scope.$on("fileSelected", function (event, args) { $scope.$apply(function () { $scope.files.push(args.file); ...

Validating multiple fields with custom logic in Mongoose during an update operation

First things first, this is not useful at all. Imagine we have a User model: const schema = new mongoose.Schema({ active: { type: Boolean }, avatar: { type: String } }); const User = mongoose.model('User', schema); Now, when we update ...

Covering the entire screen, the Div element takes up the entirety of

Just like with other pages, the main div always takes up the entire screen visible to the user. As they scroll down, another div becomes visible: example1 , example2 Regardless of the screen size, the main div will always fill the space visible to the use ...

The PHP AJAX call is returning an undefined response status

I'm facing two issues here. The first problem is that when I try to access response.status, it returns undefined. The second issue is related to the creation of "$_SESSION['promo-code'] = $arr". When I enter a promo code, I encounter the fol ...

``Redirecting a Heroku/Angular application to use the HTTPS version forcefully

I'm encountering an issue with my Angular 5 app hosted on Heroku where users can only access the HTTP version. How do I enforce redirection to the HTTPS version if users attempt to access it via HTTP? My Attempt: app.use(function (req, res, next) { ...

Utilize styled-components in next.js to import and resize .svg files seamlessly

I have been attempting to import .svg files into my next.js project, but I have not had any success. I tried importing the .svg files the same way as in my React project by creating a typing.d.ts file and importing the svg as a component. However, it did ...

Strategies for obtaining newly updated data with every request and implementing a no-cache approach in Apollo GraphQL and Angular

Every time a request is made, we need a fresh value, like a unique nonce. However, I am facing issues while trying to achieve this with Apollo's Angular client. My initial solution was to utilize watchQuery with the no-cache strategy: this.apollo.wat ...

Tips for extracting a substring from a string in JavaScript or ReactJS

Is there a way to extract a specific string from a website URL in ReactJS? For example, if the URL is https://www.mrkashyap.com/users/manish, I only want to retrieve the word manish or anything after users/. I currently have the URL stored in a variable ...

A user-friendly JavaScript framework focused on manipulating the DOM using a module approach and aiming to mirror the ease of use found in jQuery

This is simply a training exercise. I have created a script for solving this using the resource (function(window) { function smp(selector) { return new smpObj(selector); } function smpObj(selector) { this.length = 0; i ...

I'm curious, what is the exact function of ...state?

Just dipping my toes into NgRx (redux) within Angular and I'm a bit puzzled by the use of ...state in the code snippet below. My understanding is that it functions as spread operator, but I can't grasp why the data attributes from the Interface S ...

Is it possible to dynamically change an ngModel value directly from the component?

I'm currently immersed in an Angular project and my initial file setup was like this: dog.ts: export interface Dog { name: string; age: number; breed: string; } dog.component.ts: import { Dog } from '../dog'; @Component({ //setup ...

Adding Date format in jQuery using append method

I need guidance on how to properly format dates in Jquery. Currently, the date is displayed as: 2014-10-11 12:00:00 - 2014-10-11 12:00:00 $.each(data, function(key, value){ $('.alert-details').append('<div>'+ valu ...

Is it possible to retrieve the value of a session attribute set by a servlet in an HTML page using JavaScript?

As a beginner in programming, I am facing an issue with transferring data from a servlet to an HTML page. My servlet forwards to the HTML page using redirect, but I need to access the attribute "poNumber" in my session attributes and display its value on t ...

The Stripe payment form effortlessly updates in real-time thanks to the powerful @stripe/react-stripejs module

I am experiencing some difficulties with implementing Stripe payment in my Medusa-JS Next JS frontend. Whenever I enter card details in the checkoutForm, the entire StripePayment component keeps re-rendering every time I click on anything within the form ...

Applying a CSS transition to transform properties excluding rotation effects

I'm looking to apply a transitional animation to an element's transform property without affecting the rotation. Here is the code snippet: <html> <head> <link rel="stylesheet" href="style.css"> <script src="script.js ...

Is there a method to generate an endless carousel effect?

Hello, I am trying to create an infinite carousel effect for my images. Currently, I have a method that involves restarting the image carousel when it reaches the end by using the code snippet progress = (progress <= 0) ? 100 : 0;. However, I don't ...

Tips for incorporating a PDF file into a website when the Adobe Reader add-on is disabled in Internet Explorer

I attempted to insert a PDF into my website using the <embed> tag. Unfortunately, it doesn't seem to be functioning properly in Internet Explorer when the Adobe Reader add-on is disabled. Is there a solution that will allow it to work even if th ...

What could be causing the Firebase login to return undefined when using the cypress-firebase npm module?

Currently utilizing: "cypress-firebase": "^2.0.0", "firebase-admin": "^9.11.1" Within my cypress command.js file: import firebase from "firebase/app"; import "firebase/auth"; import "firebas ...

Is it possible to create an index.html page with all the necessary head tags to prevent duplicate code across multiple html pages?

Imagine I am using app.js or a Bootstrap CDN link for all of my HTML pages, but I don't want to include it in every single page individually. Is there a way to create an index.html file that includes this so that all other HTML pages load the head fro ...