+ 2
Is this realistic enough?
I tried to get this simulation quite real, but idk. https://www.sololearn.com/compiler-playground/WsmIySu18X74/?ref=app
13 ответов
+ 5
Berlida Yaa The Q&A Forum is for help with coding questions and is not a general chat. If you have a question please start your own thread 😉
+ 3
Please use the share feature in the code playground to copy and paste links in the forum 😉
+ 2
Korijn Jagersma after playing around with your code and making a few adjustments please review the following code...
https://sololearn.com/compiler-playground/Wa15d8KciGZ1/?ref=app
+ 2
Berlida Yaa please stop spamming the forum threads ...
+ 2
PAWAN SWAMI Your post could be considered spam. Please review the community guidelines before posting. Happy coding 😉
https://www.sololearn.com/Discuss/1316935/?ref=app
+ 1
William Gram There are currently no issues with the site. Are you experiencing issues? If so, please start your own thread.
+ 1
I've removed the spammy posts. Do not post in this thread unless it is related to the OP's topic otherwise it too, will be removed and reported.
0
SoloLearn lessons are missing due to a temporary site outage.
Try switching URLs g www.sololearn.com http www.sololearn.com or using the mobile app instead.
0
The Q&A Forum is for help with coding questions and is not a general chat. If you have a question please start your own thread
0
Hey, your code looks really good and simulates the ball under gravity well, including bounce and damping.
One tip: always set the height exactly to 0 on impact so the ball doesn’t sink below the floor. Also, it’s better to define a minimum velocity threshold (like below 0.01) where the ball stops moving—this prevents it from bouncing forever and makes it more realistic.
For smoother and more accurate animation, using requestAnimationFrame instead of setInterval is recommended, as it syncs better with the browser’s refresh rate and ensures fluid motion.
Overall, it’s already very clean and well-structured!