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 6761117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:08:52+00:00 2026-05-26T14:08:52+00:00

Say I have some elements in the canvas, they may be overridden with each

  • 0

Say I have some elements in the canvas, they may be overridden with each other. When clicking on a point, how can I get that very element?

update: this demo helps a lot:
http://mrdoob.github.com/three.js/examples/canvas_interactive_cubes.html

  • 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-05-26T14:08:52+00:00Added an answer on May 26, 2026 at 2:08 pm

    Use the following code. This will allow you to add a click event and do what you need to when that happens. You can view the source of the page to see what they are doing which is were I got this code from.

    document.addEventListener( 'mousedown', onDocumentMouseDown, false );
    
    var projector = new THREE.Projector();
    
    function onDocumentMouseDown( event ) {
    
        event.preventDefault();
    
        var vector = new THREE.Vector3(
            ( event.clientX / window.innerWidth ) * 2 - 1,
          - ( event.clientY / window.innerHeight ) * 2 + 1,
            0.5
        );
        projector.unprojectVector( vector, camera );
    
        var ray = new THREE.Ray( camera.position, 
                                 vector.subSelf( camera.position ).normalize() );
    
        var intersects = ray.intersectObjects( objects );
    
        if ( intersects.length > 0 ) {
    
            intersects[ 0 ].object.materials[ 0 ].color.setHex( Math.random() * 0xffffff );
    
            var particle = new THREE.Particle( particleMaterial );
            particle.position = intersects[ 0 ].point;
            particle.scale.x = particle.scale.y = 8;
            scene.add( particle );
    
        }
    
        /*
        // Parse all the faces
        for ( var i in intersects ) {
            intersects[ i ].face.material[ 0 ].color
                .setHex( Math.random() * 0xffffff | 0x80000000 );
        }
        */
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a menu that contains everything. But, I want some elements
Say we have a standard WPF-application, and I want to show some UI-elements on
Say I have some 10 categories that I need to reference in a web
Say you have an enum with some elements public enum LightColor { RED, YELLOW,
Say I have some HTML elements: <div>First</div> <div>Second</div> <div>Third</div> Whose content I select via
Say I have textboxes, dropdownlists and submit buttons. They are all inline-elements. Which means
Let's say I have a short list of strings, that can contain duplicates: <A,
I have some HTML that would have elements with multiple classes, and I need
let's say i have a list with some elements and i want to choose
Lets say I have named some elements with the following structure: 1:0 11:0 21:0

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.