Click here to Skip to main content
15,665,942 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Monogame/XNA Developers,

As you all may be well aware there's no rotation functionality to a rectangle or a bounding-box. I've went through tons of articles all stating that you're better off making your own.

So I'm doing this right now. I've made my own class with all the properties a regular rectangle would have. However, one problem is that there's a lot of performance issues rotating the rectangle itself.

I'd like to share the code with you, but it's a bit too much to just put into this question box. So I've made a pastebin[Pastebin link].

I've never made my own class for collision detection, so I hope this code isn't too bad and clear enough for others to read. I can't debug it well to see if it even works due to the mass lag it seems to create.

I'm embarassed on how slow it seems to be on the "RotatePointAroundOrigin" (100MS for one time.)

There's only one rectangle that actually gets updated every tick, which is the player, because I'll have to change the X and Y accordingly when the player moves and a collision is being checked, and even then, it will not change it every time I adjust the X or the Y, it 'll trigger a boolean which then in turn will update the points.

Please help me! I don't want to use a physics engine like Farseer or Box2D because my game is too simple for that.

What I have tried:

Tried creating a class, looks good just seems to really lag.
Updated 17-Jul-16 23:51pm
Member 11841791 18-Jul-16 5:52am    
Anyone? :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900