Instant Non-sequencial Calculation of colisions b/w objects

  • Thread starter Thread starter Luke_M
  • Start date Start date
  • Tags Tags
    Calculation
AI Thread Summary
In the discussion, a scenario is presented where multiple balls (A, B, C, D) are moving to the right at a velocity of 1, colliding with a stationary ball (E), while another ball (F) moves downward at the same velocity and collides with ball A simultaneously. The main questions revolve around whether ball E will gain a vertical velocity (Vy) from the collisions and how to calculate the new velocities of the balls post-collision for a physics model in a game. The conversation shifts to programming challenges in simulating simultaneous collisions. One participant suggests using threads for parallel processing, while another advises against this due to the unpredictability of thread execution. Instead, they recommend maintaining separate current and next values for each entity, allowing for accurate calculations of new velocities in a controlled loop iteration. This method ensures that all collisions are accounted for without the inaccuracies that can arise from sequential processing.
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.
 
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
Back
Top