Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
Rectangle intersection
Print
Pages: [
1
]
Author
Topic: Rectangle intersection (Read 1770 times)
0 Members and 1 Guest are viewing this topic.
cobrapitz
Newbie
Posts: 3
Rectangle intersection
«
on:
June 16, 2014, 07:51:15 pm »
Hello,
i need help to solve this problem..
My problem is the fact that my mouse intersects with a rotated rectangleshape as if it would be a non-rotated square
so my question is how to cut this off ( for my collision detection )?
Logged
Geheim
Full Member
Posts: 201
Re: Rectangle intersection
«
Reply #1 on:
June 16, 2014, 08:05:12 pm »
Just
google this up
, there are tons of solutions out there, probably also here on the forums, too.
Logged
Failing to succeed does not mean failing to progress!
Ixrec
Hero Member
Posts: 1241
Re: Rectangle intersection
«
Reply #2 on:
June 16, 2014, 08:07:39 pm »
I'm pretty sure SFML supports this:
rect.
getGlobalBounds
(
)
.
contains
(
mousePos
)
;
«
Last Edit: June 16, 2014, 08:46:18 pm by Ixrec
»
Logged
Laurent
Administrator
Hero Member
Posts: 32498
Re: Rectangle intersection
«
Reply #3 on:
June 16, 2014, 08:42:01 pm »
Nothing to add to Geheim's post. The algorithm is pretty basic and can be found easily with Google.
Quote
I'm pretty sure SFML supports this
SFML doesn't support rotated rectangles. The global bounds of a rotated entity is the axis-aligned bounding box of the entity's bouding box -- the outer rect in cobrapitz's drawing.
«
Last Edit: June 16, 2014, 08:43:46 pm by Laurent
»
Logged
Laurent Gomila - SFML developer
Ixrec
Hero Member
Posts: 1241
Re: Rectangle intersection
«
Reply #4 on:
June 16, 2014, 08:45:20 pm »
Ah, right. It should work for sprites though.
Logged
Laurent
Administrator
Hero Member
Posts: 32498
Re: Rectangle intersection
«
Reply #5 on:
June 16, 2014, 08:48:29 pm »
Not if they are rotated.
Logged
Laurent Gomila - SFML developer
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
Rectangle intersection
anything