What is the best method for bringing in string values (a, b, c) to create 3D shapes in three.js

Currently, as a javascript three.js beginner, I am tackling a project that involves importing string values (x, y, z) into a three.js file in order to generate cubes or spheres with those values. These values are sourced from a json file and are converted into ASCII numeric values. Upon running my script, the console displays the following output: x= 912 y= 500 z= 327

I am seeking guidance on how to write a script that can utilize these values to create cubes, spheres, or other geometrical shapes in three.js. Any assistance on this matter would be highly appreciated!

Answer №1

To enhance your JSON data, consider adding a new variable labeled 'type'. By utilizing this type, you can dynamically create different geometries such as BoxGeometry or SphereGeometry.

For a SphereGeometry, focus on adjusting the radius. If you require manipulation along the Y and Z axes, consider scaling the sphere or utilizing them as positioning coordinates within your scene.

Best regards

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

Techniques for slowing down the propagation of events with jQuery

Is there a way to show a note after a user submits a form but before they leave the page? Here is an example of what I'm currently using: $('form').submit(function(event) { $('.note').show(); setTimeout(function() { ...

Interactive World Map with Fluid Motion Animation built using HTML, CSS, and JavaScript

I am in need of an uncomplicated way to visually represent events taking place around the globe. This involves creating a 2D image of a world map, along with a method to show visual alerts when events occur at specific geographical coordinates [lat, lng]. ...

NPM rimraf - proceed with the execution even if directories are not found (do not halt with exit code 1)

My npm script is set up to run a series of synchronous commands, starting with npm run clean:install". Here is the sequence: "install:all": "npm install && bower install", "clean": "npm run rimraf -- node_modules doc typings coverage wwwroot bow ...

Struggling with generating forms using AJAX, Javascript, and HTML depending on the selection made from a drop-down menu

I am in need of a simple web form for work submissions within my organization. These submissions will fit into 4 Categories, each requiring unique information. Currently, I have a basic form set up with fields such as Requested Name, Requested Date, Acquis ...

Exclude certain packages from being processed in webpack

After setting up my webpack configuration, everything was running smoothly with the specified packages in the package.json: { "peerDependencies": { "react": "16.13.1", "react-dom": "16.13.1", ...

Having difficulty resolving JSON Object code

I am struggling to write an Android code to retrieve a JSON array. Despite following numerous tutorials, I have been unable to find a solution. Can anyone help me solve this issue? Below is the JSON data: { "total_records":"3370", "count":100, ...

Converting URL-esque information to JSON using JavaScript

Does anyone have a solution for converting an array of URL-like data into JSON format? For example, how can we convert the array ["a.b.c.d", "a.c.e.f", "a.b.c.g"] into the following JSON structure: items:{ text: "a", items:[ { ...

Tips for refreshing information in the Angular front-end Grid system?

I am currently working with the Angular UI Grid. The HTML code snippet in my file looks like this. <div ui-grid="gridOptions"></div> In my controller, I have the following JavaScript code. $scope.values = [{ id: 0, name: 'Erik&a ...

Unable to trigger jQuery .click event

Having recently delved into the world of AJAX, jQuery, and JavaScript, I am facing a challenge that I believe is rooted in a simple oversight on my part. Expressing this issue can be quite perplexing, but I'll do my utmost to articulate it clearly. I ...

"Unfortunately, the Blender JSON export in Three.js (r64) is missing important normals needed for smooth shading

When using Three.js version r64, my goal is to import an animated object from Blender with its smoothing groups. The file is exported as JSON using the Three.js Blender exporter. The animation aspect is functioning properly. Within Blender, the model app ...

What is the best way to iteratively fade in data from a MySQL database one by one?

How can I load data from a MySQL database and display it one by one with a fade-in effect? Let's say I have a total of 40 images stored in the database. First, I want to display each image like this: <li class="img" style=" list-style: none; flo ...

Unable to open new window on iOS devices using $window.open

alertPopup.then (function(res) { if(ionic.Platform.isAndroid()) { $window.open('android_link_here', '_system') } else if(ionic.Platform.isIOS()) { $window.open('ios_link_here', '_system& ...

Issue encountered while sending binary data to the server

After attempting to read a local file on the client side and sending it to the server, I encountered an error while trying to retrieve the image. JavaScript let req let rsp async function _post(url,data) { req = await fetch(url,{method: 'POST' ...

Saving information in JSON format into MongoDB

I'm currently working on a project to create a digital card generator app using node.js. My goal is to store the card data in JSON format within a MongoDB database. I am utilizing mongoose ODM for this task, but it seems that mongoose does not directl ...

Using a Promise to signal the completion of certain tasks

In our application, we have multiple controllers assigned to different tabs/pages. I am looking for a way to signal the completion of a task in one controller so that it can be used in another controller. I believe Promises are the solution for this, and I ...

The Strophe.muc plugin and backbone improper binding of callbacks

Following the initial group message, I'm experiencing an issue with the strophe.muc plugin not responding to subsequent messages. Although I receive the first presence, message, and roster from the room, any additional messages and presence stanzas do ...

How to automatically scroll to the bottom using jquery/css

I've recently developed a chatroom using li elements, but I'm encountering an issue where the chat doesn't stick to the bottom once it reaches a certain number of messages. I suspect it has something to do with the height settings, but I can ...

Rev up your content - eliminate blank spaces

Is there a way to eliminate leading or trailing whitespaces from a value using Jolt transform script? An Illustrative Input { "parent": { "rating": { **"value": "Good "** } } } The Specification [ { "operation": "shi ...

Tips for assigning unique names to each radio input groupNeed to assign unique names to radio

Currently, I am seeking a dynamic solution to alter the name associated with a set of radio input buttons. The situation involves creating a travel itinerary where users can choose between "domestic" and "international." Based on this selection, the corre ...

Remove httpOnly cookies in Express

Can browser cookies with the attribute HttpOnly:true be deleted? Here is a snippet of my login endpoint: async login(@Ip() ipAddress, @Request() req, @Res() res: Response) { const auth = await this.basicAuthService.login(req.user, ipAddress); ...