When in doubt, add debugging graphics.
The (x,y) coordinates around the perimeter are of the vector from that
point pointing towards the center. Or so I hope. It's what it looks
like to me. Remember the origin (0,0) starts at the top left of the
screen.
I figure it's time to try the rotate function. (And really, this is why
it makes sense to read the documentation. Point.rotate() is right
there. Of course, I'd already read that part, but without any
application to cement the knowledge in play, the memory of it must have
evaporated right quick.
VR = VR.rotate(VectorRay.getDirectedAngle(VR));
VR is the UnitVector that the ball is moving along.
VectorRay is the UnitVector from the point of impact to the center.
It still doesn't work. (You can see the ball jiggle at the edges --
does a random walk, essentially.) But I have high hopes for mañana.
Be it a curse or a blessing. I always seem to have high hopes for
mañana.
Previous Brett Code Index Next in Series
OctoWars Project
Copyright © 2013 Brett Paufler