Collision Detection in 2D Motion

  • Thread starter kachilous
  • Start date
  • #1
15
0

Main Question or Discussion Point

I have created a very simple numerical simulation that models an object being thrown off a building at some angle, and when the object hits the ground, the simulation stops. Now I want to add in collision detection. How would I go about doing this? What would be the equations needed to compute the new values of time, velocity and position?
 

Answers and Replies

  • #2
Khashishi
Science Advisor
2,815
493
What's the shape of the object and the ground? Is the object spinning? Are you interested in just the moment of impact, or you want to know what happens afterward?

If you want to know what happens afterward, you need to make some assumptions about the elasticity, how it deforms, and how much rotational energy is transferred to the ground.
 
  • #3
15
0
It is a ball that has elasticity. I expect the ball to bounce upon impact with the ground. The ground is a flat surface that is stationary
 
  • #4
Khashishi
Science Advisor
2,815
493
It depends on how thorough you want to be. The easiest thing to do is just simulate with a constant step size, and do something like
a_y(t+dt) = a_y(t) - g*dt
v_y(t+dt) = v_y(t) + a_y(t)
y(t+dt) = y(t) + v(t)
if y(t) < 0, then {
y(t+dt) = 0
v_y(t+dt) = -elasticity*v_y(t)
v_x(t+dt) = damping*v_x(t)
}

Of course, you didn't say how detailed your simulation is.
 
  • #5
610
5
No, there's something even easier. If the collision is perfectly elastic (which is very close to true for bouncy balls), and the thing it is hitting is very massive (like the ground or a wall), then you just flip the direction of the velocity vector component that is normal to the surface of collision.
 

Related Threads on Collision Detection in 2D Motion

  • Last Post
Replies
4
Views
1K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
3
Views
1K
  • Last Post
Replies
5
Views
3K
  • Last Post
Replies
1
Views
3K
  • Last Post
Replies
4
Views
22K
  • Last Post
Replies
2
Views
5K
Replies
4
Views
3K
Replies
10
Views
3K
Top