[Solved] I want to directions after collision of two balls? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 6

[Solved] I want to directions after collision of two balls?

https://code.sololearn.com/W4v0nu4WIJMf/?ref=app

21st Aug 2021, 12:51 PM
SAN
SAN - avatar
5 Réponses
+ 2
look at this code: https://code.sololearn.com/W5qWuZcATtX4/?ref=app the physics are in the crash() function, it also plays a note for each collision, which we did originally to keep track
21st Aug 2021, 4:44 PM
bell
bell - avatar
21st Aug 2021, 1:15 PM
JaScript
JaScript - avatar
+ 2
let me know if you need more explanations to the code, it is very crowded with functions you may not need. coe is a coefficient of elasticity, which causes balls to slow down by 5% in each collision. Just set to 1 if you want perfectly elastic collisions (or remove from your equations)
21st Aug 2021, 4:57 PM
bell
bell - avatar
+ 1
bell thank you so much
21st Aug 2021, 5:00 PM
SAN
SAN - avatar
+ 1
Help me to learn scanner
23rd Aug 2021, 12:33 PM
Mintesnot Leliso
Mintesnot Leliso - avatar