Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8652711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:22:18+00:00 2026-06-12T14:22:18+00:00

Background: I’m a dev that knows JS, but is relatively new to Three JS.

  • 0

Background: I’m a dev that knows JS, but is relatively new to Three JS. I’ve done a few small projects that involve static scenes with basic repeating animation.

I’m currently working on a modified version of Google’s Globe project http://workshop.chromeexperiments.com/globe/. Looking back, I probably should have just started from scratch, but it was a good tool to see the approach their dev took. I just wish I could now update ThreeJS w/o the whole thing falling apart (too many unsupported methods and some bugs I never could fix, at least not in the hour I attempted it).

In the original, they are merging all of the geometric points into one object to speed up FPS. For my purposes, I’m updating the points on the globe using JSON, and there will never be more than 100 (probably no more than 60 actually), so they need to remain individual. I’ve removed the “combine” phase so I can now individually assign data to the points and then TWEEN the height change animation.

My question is, how do I manually select a single point (which is a Cube Geometry) so that I can modify the height value? I’ve looked through Stack Overflow and Three JS on GitHub and I’m not sure I understand the process. I’m assigning an ID to make it directly relate to the data that is being passed into it (I know WebGL adds an individual name/ID for particles, but I need something that is more directly related to what I’m doing for the sake of simplicity). That seems to work fine. But again, as a JS dev I’ve tried .getElementById(id) and $(‘#’+id) in jQuery, and neither works. I realize that Geometry objects don’t behave the same way as HTML DOM objects, so I guess that’s where I’m having struggles.

Code to add a point of data to the globe:

function addPoint(lat, lng, size, color, server) {
    geometry = new THREE.Cube(0.75, 0.75, 1, 1, 1, 1, null, false, { px: true,
    nx: true, py: true, ny: true, pz: false, nz: true});

    for (var i = 0; i < geometry.vertices.length; i++) {
        var vertex = geometry.vertices[i];
        vertex.position.z += 0.5;
    }

    var point = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial ({
        vertexColors: THREE.FaceColors
    }));

    var phi = (90 - lat) * Math.PI / 180;
    var theta = (180 - lng) * Math.PI / 180;

    point.position.x = 200 * Math.sin(phi) * Math.cos(theta);
    point.position.y = 200 * Math.cos(phi);
    point.position.z = 200 * Math.sin(phi) * Math.sin(theta);

    if($('#'+server).length > 0) {
        server = server+'b';
    }

    point.id = server;

    point.lookAt(mesh.position);

    point.scale.z = -size;
    point.updateMatrix();

    for (var i = 0; i < point.geometry.faces.length; i++) {
        point.geometry.faces[i].color = color;
    }

console.log(point.id);

    scene.addObject(point);
}

So now to go back, I know I can’t use point.id because obviously that will only reference inside the function. But I’ve tried ‘Globe.id’, ‘Globe.object.id’, ‘object.id’, and nothing seems to work. I know it is possible, I just can’t seem to find a method that works.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:22:19+00:00Added an answer on June 12, 2026 at 2:22 pm

    Okay, I found a method that works for this by playing with the structure.

    Essentially, the scene is labeled “globe” and all objects are its children. So treating the scene as an array, we can successfully pass an object into a var using the following structure:

    Globe > Scene > Children > [Object]

    Using a matching function, we loop through each item and find the desired geometric object and assign it to a temporary var for animation/adjustment:

    function updatePoints(server){
        var p, lineObject;
    
        $.getJSON('/JSON/'+server+'.json', function(serverdata) {
    
            /* script that sets p to either 0 or 1 depending on dataset */
    
            var pointId = server+p;
    
            //Cycle through all of the child objects and find a patch in 
            for(var t = 3; t < globe.scene.children.length; t++) {
                if(globe.scene.children[t].name === pointId) {
                    //set temp var "lineObject" to the matched object
                    lineObject = globe.scene.children[t];
                }
            }
    
            /* Manipulation based on data here, using lineObject */
        });
    }
    

    I don’t know if this is something that anyone else has had questions on, but I hope it helps someone else! 🙂

    EDIT: Just realized this isn’t a keyed array so I can use .length to get total # of objects

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: My employeer at my non-programming job knows that I am an undergraduate CS
Background: I'm new to CakePHP. I have a small test site (mostly composted of
Background: We're building an application that allows our customers to supply data in a
Background: I would like to dismiss a modalView that I have presented earlier and
Background: I have a css and a js that is used only by the
Background As CopyLocal=true causes a lot of build slowdowns as projects and solutions grow
Background I once wrote this method: private <T> SortedSet<T> createSortedSet() { return new TreeSet<T>();
Background information first: We are using a strongly-typed DataSet to manage transaction files. That
Background I have a joined table consisting of Incidents, Customers, and Areas that I'm
Background: At my company we are developing a bunch applications that are using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.