Instant Non-sequencial Calculation of colisions b/w objects

  • Thread starter Thread starter Luke_M
  • Start date Start date
  • Tags Tags
    Calculation
Click For Summary
SUMMARY

This discussion focuses on the simultaneous collision of multiple objects in a physics simulation, specifically addressing the scenario where balls A, B, C, D are moving at a velocity of 1 m/s to the right and collide with stationary ball E while ball F, moving down at 1 m/s, collides with ball A. The participants emphasize the importance of using a two-set value system for managing current and next velocities to accurately simulate non-sequential collisions in a game physics engine. The suggestion to avoid using threads for this purpose is highlighted due to their unpredictable timing, which can lead to inaccuracies in the simulation.

PREREQUISITES
  • Understanding of basic physics principles related to collisions
  • Familiarity with programming concepts, particularly loops and data structures
  • Knowledge of game physics engines and simulation techniques
  • Experience with multithreading and its implications in programming
NEXT STEPS
  • Research "Physics-based collision detection algorithms" for accurate simulations
  • Explore "Game physics engines" like Box2D or Unity's physics system
  • Learn about "Data structures for game state management" to handle current and next values
  • Investigate "Multithreading vs. single-threaded game loops" for performance optimization
USEFUL FOR

This discussion is beneficial for game developers, physics simulation programmers, and anyone interested in creating accurate and efficient collision detection systems in their projects.

Luke_M
Messages
10
Reaction score
0
Balls A,B,C,D are traveling at V=1 to the right next to each other like a train they hit ball E whom is stationary. At the exact instant ball F is traveling down and hits A, F is traveling at V=1 but down

Here is a diagram this is birds eye view:

*=collision
both collisions have happened at the same time
|
|
V
F
*
-------->ABCD*E



A: Vx=1 m=10
B: Vx=1 m=10
C: Vx=1 m=20
D: Vx=1 m=10
E: Vx=0 m=60
F: Vy=1 m=10

will object E receive any Vy ?
why not ?
what are the new V's ?
I need to know how to work this out as I am making a physics model in my game.

If you are a programmer maybe you can also answer this question:
In the real world collisions can happen all at once like in my above example. How can I do this in code ? I can only do them sequentially with for loops. is this normal practice in constructing a physics engine. Because if I do the collision between F and A after the other collisions A's new V will incorrectly not be included in the calculation.
Thanks in advance.
 
Last edited:
Technology news on Phys.org
Luke,

The physics part I cannot easily help you with. As for the programming part, when you want multiple things to happen in parallel you use threads. A thread is a lightweight process. Each thread gets a timeslot much like a process does in a multiprocessing operating system. This is the closest you will get to having them run non-sequentially. I hope this helps.

Ryan
 
I would not use threads for this because their time slices are unpredictable: some threads will sleep longer than others, causing your model to also be unpredictable. Instead, I would maintain two sets of values for each entity in your model: current values and next values. At each iteration of the loop, use the current values as input in the calculation of the next values. At the end of the loop, set the current values to the 'next' values you just calculated for use in the next iteration.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 30 ·
2
Replies
30
Views
2K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K