Understanding Collision Scenarios in Physics-based Game Development

  • Thread starter Thread starter Ruddiger
  • Start date Start date
  • Tags Tags
    Collision
Click For Summary

Homework Help Overview

The discussion revolves around understanding collision scenarios in a physics-based game development context, specifically focusing on the interactions between two ships of different sizes and masses in space. Participants explore concepts related to elastic and inelastic collisions, momentum conservation, and the effects of rotation on collision outcomes.

Discussion Character

  • Exploratory, Conceptual clarification, Mathematical reasoning, Problem interpretation

Approaches and Questions Raised

  • Participants discuss the nature of collisions, questioning how momentum is transferred between colliding objects. There are inquiries about the coefficient of restitution and its role in determining the elasticity of collisions. Some participants also explore the implications of rotation on collision dynamics and the complexity it introduces.

Discussion Status

The discussion is active, with participants sharing insights about the mathematical modeling of collisions and suggesting resources for further learning. Some guidance has been offered regarding the treatment of velocity components and the impact of material properties on collision behavior. Multiple interpretations of the collision scenarios are being explored without reaching a consensus.

Contextual Notes

Participants are working under the constraints of game development requirements, which may impose specific rules on how collisions are handled. There is also mention of the potential complexity introduced by 3D scenarios and the need for advanced mathematical understanding.

Ruddiger
Messages
7
Reaction score
0
I'm trying to implement some physics in a game I'm coding and need help with understanding some basic concepts. I have two ships in space of different size and mass. Can somebody please explain to me how to determine what happens when the two ships collide? How do I know if when A collides with B: A might stop completely and move B, or A might move B and keep moving at a slower rate, or A might move B and bounce in the opposite direction?

I don't know if this seems like a silly question or not but I would appreciate any help anyone can give. Thanks!
 
Physics news on Phys.org
So, if I undertand this right, in an elastic collision the two objects basically exchange each others momentum so that no matter how massive object A is, if it hits a stationary object B, A will become stationary and launch B with its momentum? But in an inelastic collision the two objects will always "stick" and travel together at a lesser speed? I'm guessing my scenario is inelastic?
 
The collision will conserve momentum. However, you have to choose yourself how quickly the ships separate from one another after the collision, by saying for example whether the ship's shields crumple to absorb some of the impact energy (sticking together in the most extreme case) or whether they explode releasing further energy (or neither, which is the elastic case).
 
The maths can become a little challeging, but (barely) manageable.

If you model the ships as two balls and consider their velocity components parallel to the line of action (line connecting their centers at point of impact)

[tex]u_1,\ m_1,\ u_2,\ m_2[/tex]

assuming no friction. You could set up two equations to solve for their final parallel velocity components

[tex]v_1,\ v_2[/tex]

by considering momentum conservation parallel to the line of action:

[tex]m_1 u_1 - m_2 u_2 = m_2 v_2 - m_1 v_1[/tex]

this assumes a + velocity component direction directed along [tex]u_1[/tex].

Another equation is obtained by assuming a coefficient of restitution between the two ships

[tex]0 \leq e \leq 1[/tex]

where 0 will give you an inelastic collision and 1 a perfectly elastic collision. To set up the equation you use the fact that

[tex]e = \frac{relative\ speed\ of\ separation}{relative\ speed\ of\ approach}[/tex]

which again will involve just the velocity components parallel to the line of action. Between these two equations you can then solve for

[tex]v_1,\ v_2[/tex]

The velocity components of the ships perpendicular to the line of action will then not be changed as a result of the collision.
 
Last edited:
Ok, this is starting to make some sense now. So the coefficient of restitution controls the elasticity of a collision. Is it safe to say that it represents a ratio dictating how much the mass of the objects will influence the transfer of momentum? Is this coefficient constant between two objects, or does it vary based on other factors?

Also, for a 3D scenario, do I split the velocity vectors into parallel and perpendicular components (to the line of action, right?), perform these calculations to transfer momentum on the parallel components and then add back the unmodified perpendicular components?

And finally (sorry if I'm asking too much), how drastically do things change if the ships are moving AND rotating around their centers of mass? Is there some preliminary way of adding the rotation to the translation of the ships and still perform the same calculations?

Thanks a lot for your help thus far guys!
 
The coeff of restitution is determined by the two materials and descibes how much the relative motion of the two colliding objects will be altered.

Yes the procedure will be the same for 3D. The velocity components (and therefore the momentum) in a plane perpendicular to the line of action will be unaltered by the collision.

If you consider rotation also things gets more complicated.

Maybe you should try and get "Physics for game developers" by David M. Bourg. His book is mathematically advanced (with DirectX collision simulations in 3D). Although I did find some errors in his maths, but the simulations look realistic. The first chapter can put one off a bit since he discusses things like inertia tensors, but the maths are very neat and not that bad at all. I bought a secondhand copy from Amazon (it was brand new - I guess the game programmer gave it one look and was totally overwhelmed by the maths and send it back, but as I said it is really not that bad and quite understandable if you put the effort in and work through it).

The example code is available at

http://examples.oreilly.com/physicsgame/"
 
Last edited by a moderator:
Made some slight changes to previous post.
 
Thanks andrevdh, that might be the best way to go about it. I'll look through the sample programs and maybe get the book you suggested.
 
  • #10
As soon as one moves into 3D the maths gets quite advanced. But Bourg keeps it quite neat and organized - even his C++ programming is clear. Work through the book and post here for some help.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 32 ·
2
Replies
32
Views
2K
  • · Replies 13 ·
Replies
13
Views
1K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 71 ·
3
Replies
71
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
9
Views
3K
Replies
20
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K