123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|657|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> On Topic -> Angles

Fri, 11 Jul 2008, 21:03
Scherererer
i can't think of any geometric postulate to help you here... are there any other known angles? I don't know what you're doing, but it would appear that you're going about it in the wrong way... what are you trying to accomplish?

-=-=-
YouTube Twitter
Computer Science Series: Logic (pt1) (part 2) (part 3) 2's Complement Mathematics: Basic Differential Calculus
Fri, 11 Jul 2008, 22:00
Scherererer


yeah, you're going about it a bit off. Reflection is based on a simple principal: the angle of incidence equals the angle of reflection. So, as you can see the angle that it hits the surface is the same as the one that it reflects at. if you need to turn the object, you can just turn it (2*theta), where theta is the angle of incidence.

-=-=-
YouTube Twitter
Computer Science Series: Logic (pt1) (part 2) (part 3) 2's Complement Mathematics: Basic Differential Calculus
Sat, 12 Jul 2008, 07:01
mike_g
A cheap way to do it in 2d for square walls is to just invert one of the velocities. For example when a ray hits the ground or celing just do vx = -vx. Or if it hits a wall vy=-vy.
Sat, 12 Jul 2008, 09:19
Scherererer
mike_g: if it hits the ground or ceiling it should be vy=-vy and for walls vx=-vx; otherwise it would try going through the wall but move towards it differently.

-=-=-
YouTube Twitter
Computer Science Series: Logic (pt1) (part 2) (part 3) 2's Complement Mathematics: Basic Differential Calculus
Sat, 12 Jul 2008, 10:19
mike_g
Oh yeah you invert both, lol
Thu, 17 Jul 2008, 18:56
Orion Pax
Well I am only posting this because I am bored and trying to get today's events off my mind.

At any rate.

Blitz does not count angles in a full 360 degree's. It goes from 0-179, then -180 to -1. so it goes 0,1,2,...178,179,-180,-179,...-2,-1,0 and back around....

Now what I did in my tennis WW is I Multiplied the balls angle at time of impact by -1. This is essentially the same as *2. Then we add 180 degree's so that its facing in the reflected angles direction. You can do this without ever knowing any other angle, except the initial angle.

Now when you multiply it by -1 initially what you are doing is putting it on the same vector as the angle that you need, but in the opposite direction. That is why you need to add 180 to it so it FLIPS directions. This should work the same in 2d as well as 3d. You just wont have a Z angle.

Trust me it works. Look at my tennis WW entry. My math for that works. I just have to work on the physics.
Fri, 18 Jul 2008, 17:43
Forklift_Fred
You could argue that Blitz's angle range is -180 to 180.

And it always catches me out

Multiply by -1 and rotate 180 sounds really clever and I'm sure it'll be very handy to remember, thanks.

Thinking about it, it's very logical but I'm not sure I'd have thought of it on my own!

-=-=-
Come rain or shine...
Fri, 18 Jul 2008, 19:57
Orion Pax
Yeah its a cheap quick fix and there really isnt any REAL mathematics to it. It just hit me like a rock when I was working on that WW. Especially after I figured out that blitz doesnt return the angles 1-360....which is weird and pointless and really stupid. I honestly cant think of a good reason NOT to return the angles in that range. Or a good reason not to do it. But I didnt design it....so oh well.

Thanks for the comment fred!