Timeline for Bouncing Balls in angular movement
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 26, 2016 at 14:43 | answer | added | Shaun Wild | timeline score: 1 | |
| May 25, 2016 at 20:23 | comment | added | Dan | Also, trigonometric functions are expensive to calculate, especially in tight loops (e.g. checking vs. every collidable object in your scene). Generally it's much easier to store position, velocity, and acceleration as distinct components of each major axis. Then it's as simple as reversing xVel when you collide with a vertical wall, and yVel when you collide with a horizontal wall. If you must store direction as an angle, or are colliding with non-AABB (axis-aligned bounding boxes), then that's a different story. | |
| May 25, 2016 at 20:18 | comment | added | Dan | What is the range of b.angle, and which direction do you expect the object to be moving when angle == 0? Your code doesn't seem to conform to the standard unit circle, where normally x = cos(theta) and y = sin(theta). Example 1 Example 2 | |
| May 25, 2016 at 19:10 | comment | added | Acuzik | Edited for clarification, sorry about that! @Dan | |
| May 25, 2016 at 18:50 | history | edited | Acuzik | CC BY-SA 3.0 | Added a question |
| May 25, 2016 at 18:28 | comment | added | Dan | I think you forgot to ask a question. Perhaps you could expand on what trying to combine them both means? Do you mean when the objects contacts the floor and a wall at the same exact time? In that case, I usually just reverse both velocity components. | |
| May 25, 2016 at 16:35 | history | asked | Acuzik | CC BY-SA 3.0 |