| Issue 2: | Some asteroids escape the force field | |
| 1 person starred this issue and may be notified of changes. | Back to list |
A good example of this is if you knock the force field away, stationary asteroids will ALWAYS escape. Also a pulse right on the edge will cause asteroids to escape. Reason for this is unknown.
Jun 18, 2012
Project Member
#1
apsill...@gmail.com
Jun 19, 2012
Okay, he's the problem: !inner.contains(new Point2D.Double(s.getX() + s.getXVel(), s.getY() + s.getYVel())) This line is trying to test if the object is about to exit the force field, but it's not quite right. Currently, it tests if the velocity of the object at *this time tick* is sufficient to launch it out of the circle. Sometimes, this check turns out to be false, and then on the next tick, the object accelerates to a higher velocity than it had at the previous time tick, which allows it to escape the force field. Solving this problem is non-trivial: we either need to 1) calculate the velocity that the object will have at the next time tick, or 2) perform our collision testing just after velocities are calculated and just before the objects are moved. |