Bouncing Smiley Face
The laws for rotation are probably wrong (I made them up actually), but that's not what this file is about. Shown here is a very simple code that creates a nice animation, which can be quickly edited to suit anyone's needs.
The parameters are ball radius, gravity, initial velocity in the Y direction, initial velocity in the X direction, vertical speed conservation (%), horizontal speed conservation (%) and initial angular velocity.
Please note that the ball may stop moving at different locations for different trials, even with the same input parameters. This is due to the slight randomization of the deformations of the ball and the ground, which could lead to the ball getting "stuck" to the ground at times and stopping there. This is normal and deliberate.
Set the vertical speed conservation as a value larger than 100 (e.g. 130) for a small bonus ;)
Citation pour cette source
Husam Aldahiyat (2026). Bouncing Smiley Face (https://fr.mathworks.com/matlabcentral/fileexchange/23081-bouncing-smiley-face), MATLAB Central File Exchange. Extrait(e) le .
Compatibilité avec les versions de MATLAB
Plateformes compatibles
Windows macOS LinuxCatégories
- Gaming > Just for fun >
Tags
Remerciements
Inspiré par : Bouncing Ball Physics
Découvrir Live Editor
Créez des scripts avec du code, des résultats et du texte formaté dans un même document exécutable.
| Version | Publié le | Notes de version | |
|---|---|---|---|
| 1.2.0.0 | Code now works on systems without the Image Processing Toolbox. |
||
| 1.1.0.0 | Fixed eccentricity error, horizontal conservation error. |
||
| 1.0.0.0 |
