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

  • Home
  • SEARCH
  • 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 8795397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:22:53+00:00 2026-06-13T23:22:53+00:00

I am doing simple collision detection and although I can easily detect up/down objects

  • 0

I am doing simple collision detection and although I can easily detect up/down objects with a THREE.ray, I am having a hard time to find what’s in front/back of a camera (or any object) when they rotate? I tried projecting a ray with a projector and to display how that ray shoots using helper arrow. Once I start rotating camera around Y axis, ray points to inverse direction or just acts weirdly…

ray = new THREE.Ray();
projector = new THREE.Projector();
vector = projector.projectVector( coll.getObject().matrix.getPosition().clone(), camera );
ray.direction = vector.normalize();
ray.origin = coll.getObject().matrix.getPosition().clone();
helper.setDirection(ray.direction.clone());
helper.position = ray.origin.clone();
  • 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-13T23:22:54+00:00Added an answer on June 13, 2026 at 11:22 pm

    I ended up setting a cube around my object attached to a camera and shooting rays through vertices added up, like this:

    vertices = coll.getObject().geometry.vertices;
            rad = coll.getObject().boundRadius+1;
            var directions = {
                "up": [4,1],
                "down": [6,2],
                "front": [3,4],
                "back": [7,0],
                "left": [5,6],
                "right": [1,2],
            };
            var collisions = {
                "up": {},
                "down": {},
                "front": {},
                "back": {},
                "left": {},
                "right": {},
            };
            for (key in directions){
                (directions[key].length > 1) ? localVertex =  vertices[directions[key][0]].clone().addSelf(vertices[directions[key][1]].clone()) : localVertex = vertices[directions[key][0]].clone();  
                globalVertex = coll.getObject().matrix.multiplyVector3(localVertex);
                directionVector = globalVertex.subSelf( coll.getObject().position );
                ray = new THREE.Ray( coll.getObject().position.clone(), directionVector.clone().normalize(), 0, 1000 );
                intersects = ray.intersectObjects(obj, true);
                if (intersects.length > 0) {
                    distance = intersects[ 0 ].distance;
                    if (distance >= 0 && distance <= rad) {
                        collisions[key] = intersects[ 0 ];              
                    } else {                        
                        collisions[key] = false;
                    }
                } else {
                    collisions[key] = false;
                    ++falseCount;
                }       
            }                   
        }
        return (falseCount !== 6) ? collisions : false;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a very simple collision detection demo: http://jsfiddle.net/colintoh/UzPg2/5/ As you can see, the
I am having a problem with GameQuery (jQuery) collision detection Tthey just never seem
I am doing simple (for now) application to draw on canvas. I can draw
I'm having trouble doing simple functions on a data frame and am unsure whether
I have this formula for simple circle collision detection: private bool CircleCollision(Rectangle Circle1, Rectangle
I've been doing simple multi-threading in VB.NET for a while, and have just gotten
I'm doing simple divisions in c#, and I am a bit puzzled by its
What's the easiest way of doing simple pattern matching a la .something.com something.com/ something.com/somefolder/*.jpg
I'm considering the feasibility of doing simple reporting on Trello data. My quick review
In My iphone Application,I am doing simple image animation in a View and in

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.