[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] How to rotate a rect
--- Leonardo Santagada <firstname.lastname@example.org> wrote:
> I am not only talking about pixel collision
> detection but also bounding boxes that can be
> or anything that you know how to
> implement in python.
I'd guess that you'll want to do your own bounding box
management seperate from rectangles. The real
question is this:
What do you want the bounding box to acheive. One
reason to use bounding boxes for collision detection
is that it's computationally cheap. Using the
rectangle + pixel approach may still outperform a more
realistic geometry system. Finding the corners of the
bounding box is easy enough if you know the width,
height, center x,y and rotation angle of the object.
Just use math.sin and math.cos to break the angle into
x and y components which you then multiple by half the
width and half the height to get offsets from the
My description is poor, but I haven't really woken up
yet this AM and I'm assuming that I'm actually telling
you things you already know in the back of your mind.
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
pygame mailing list