Moving ball colliding with a side of a cube

  • Thread starter Thread starter muffinman123
  • Start date Start date
  • Tags Tags
    Ball Cube
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
muffinman123
Messages
17
Reaction score
0

Homework Statement



assuming the path of the ball is linear, if the ball collides with the cube, I want to find which side the cube the ball collided with. this is a discreet problem, the ball's position and velocity are always known. the cube's size is bigger than the ball's size in the way that the ball's radius is negligible in this problem, and the time step is small enough so that the change in position of the ball in different time step is also small enough.


Homework Equations



line equation using ball's current position and velocity
plane equation using 3 corners of a side of the cube

The Attempt at a Solution



I figured the collision took place once the ball just penetrates the cube, and the solution is to determine the line equation of the ball and the plane equation of the six sides of the box and determine which plane the line segment is intersecting.

the problem is I don't know how to calculate the equation of the line in 3D and equation of planes and then calculation for the intersections. I have forgotten much of the math needed to solve problems like this...
 
Physics news on Phys.org
Where they touch one co-ordinate will match one of the co-ordinates of the plane and the others will be in bounds. So consider a cube with one corner at the origin (0,0,0) and another at (1,1,1). Then you can check if the surface of the ball is on one of the faces eg if any of these conditions are true..

0, 0<y<1, 0<z<1
or
1, 0<y<1, 0<z<1
or
0<x<1, 0, 0<z<1
or
0<x<1, 1, 0<z<1
or
0<x<1, 0<y<1, 0
or
0<x<1, 0<y<1, 1