• Create Account

Banner advertising on our site currently available from just \$5!

# ewaldhew

Member Since 13 Mar 2013
Offline Last Active Apr 11 2013 03:04 AM

### In Topic: Circular Playing Field

16 March 2013 - 03:13 AM

Well, I basically sat down and considered carefully the four possible cases (in each of the four quadrants) and figured out that if the player was on the right half (π/2 < θ < -π/2) of the field, rx would be -rcosθ and rwould be -rsinθ, where r is the player's resultant speed (playerspeed for horizontal/vertical movement, and sqrt2*playerspeed for diagonal). Then, on the left side, rx = rcos(θ+π), ry = rsin(θ+π). What I was doing wrong before was, as you can see from the bit of code in my first post, not computing r at all, and using tan, as well as getting Newton's Third Law wrong. Now that I got my maths(and physics) figured out, it works exactly as I wanted it to.

Also, the jagged movement was due to me forgetting to add in the code to restrict the player's position. So the player would move outside the boundary momentarily before being pushed back in by the restoring force.

In conclusion, I was not thinking straight at all before, and adopted a totally illogical approach =\ I still feel kinda dumb even now D:

### In Topic: Circular Playing Field

15 March 2013 - 07:43 AM

Thanks for all the input, I finally solved it.
However, one problem remains, is that the movement seems...jagged, for lack of a better term, as if the curved wall was actually made of steps.

EDIT: I fixed the jagged movement too, thanks again for the help =D

PARTNERS