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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:26:27+00:00 2026-06-07T10:26:27+00:00

I have 2 simple 3D objects in my scene (a sphere and a cube),

  • 0

I have 2 simple 3D objects in my scene (a sphere and a cube), and I would like to detect if they are colliding or not.

How can this be achieved?

  • 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-07T10:26:29+00:00Added an answer on June 7, 2026 at 10:26 am

    The simplest option would be to use the euclidean distance between the two objects, using Vector3’s distanceTo() or distanceToSquared functions.

    e.g.

    console.log(yourCube.position.distanceToSquared(yourSphere.position));
    

    If the distance between the two objects is greater than the sum between of the sphere’s radius and cube’s side, then that would be a potential collision. I’m also suggesting distanceToSquared because it’s faster(since it’s not calling sqrt) and it’s still useful to check for collisions.

    Note that this method is not super exact – it’s essentially checking collisions between two spheres (estimating the cube as a sphere with the radius equal to half the cube side), but I’m hoping it’s close/good enough for your setup since it’s the easiest and fastest to implement in my opinion.

    You might notice that the corners of the cube will be colliding without triggering a collision until a certain distance. You can adjust a ‘threshold’ by passing a different cube side ratio. Imagine a sphere around your cube and how large should that sphere’s ratio be to get a decent estimated collision for your setup.

    Another method that comes to mind is to find the point on the sphere closest to the cube:

    • You know can get the point from the centre of the sphere to the centre of the cube by subtracting the two position vectors
    • You can get the point on the sphere in the cube direction by normalizing the above difference vector and them scaling it by the sphere radius
    • you can then check if that point is inside the cube (by checking the if the coordinates are within the cube’s axis aligned bounding box(AABB)

    e.g.

    var pointOnSphere = yourSphere.position.clone().sub(yourCube.position).normalize(). multiplyScalar(yourSphereRadius);
    

    This if off the top of my head, so I can’t guarantee the above snippet will work, might be worth placing a particle at pointOnSphere’s coordinates to check first.

    There are other more advanced collision detection algorithms in 3D you can check out in this book, but it’s best to keep things as simple/fast as possible.

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

Sidebar

Related Questions

I have a simple question. Can a grid automatically resize the objects in it
I'm writing a simple scene graph to hold some objects so I can control
I have a simple OpenGL application where I have 2 objects displayed on screen:
I have a simple json string which contains a collection of objects http://sandapps.com/InAppAds/ads.json.txt When
I am using a simple repository pattern and have objects with a LazyList such
Currently I have a simple knockoutJS object, with a few observables. But this object
I have a simple iOS 5 storyboard that contains a tableview controller scene. However,
I have a simple question about passing custom objects via a webservice. I created
I would like to create a simple mesh in Blender (2.50) via the Python
I would like to have a drag-and-drop feature based on images. If I drag

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.