PDA

Click to See Complete Forum and Search --> : Calculating Collision Points On A Rectangle



mjhardisty
10-27-2002, 02:39 PM
Hi,

I basically have a rectangular shaped object (a car) that rotates as desired on key downs. I need to calculate 8 collision points on the car to test against the map and other objects below.

As the attachment I can successfully calculate points 2 and 8 from already knowing the x,y of point 5 from the rectangle._x and rectanble._y.

So, what is the best way to calculate all the other points based upon x,y and the rotation of the object? My trigonometry isn't too hot I'm afraid so I'm putting the question to the board.

Thanks a lot

Markp.com
11-20-2002, 09:00 PM
I use seperate movieclips on www.internationaldrugsbaron.com then place them in each desired hit test position.

Hint: you only need them on each side of the car. :)

Somar
11-30-2002, 07:23 PM
Nothing to do with this thread but i was messing around with the ellipse equasion and realized that:

y = +- (b^n * (1 - (x/a)^n))^(1/n)

begins to approximate a rectangle with width a and height b as n becomes a really high even integer.
(when n=2 it's the ellipse equation :P)

Later,
Somar!