SFML community forums
Help => Graphics => Topic started by: Prodigga on April 22, 2012, 01:25:43 am
-
Hey guys in trying to do some collision testing or ray casting with sfml's lines. I am doing a line to line collision check, so I need to know the start and end points of either line. Figured this'd be easy since I specify those 2 points when I create the line using shape::line. But I looked thro the shapes points and instead of 2 points I found 5. And none of them contain the coordinate of the start/end points. Any way I can retreive this?
-
i should probably add that i dont think im using the latest version of SFML. (2?). I am using a customer framework created by my uni, that is built on top of SFML. (basically its just a wrapper for it, because i still get direct access to everything SFML). I've realized it may not be the latest after reading around - ive noticed that i have an input object for input rather than keyboard/mouse/etc. i am at work now and can confirm tonight
-
The reason is that the "line" shape can have arbitrary thickness - it's essentially a rectangle in the right position.
You should really decouple your physics from rendering anyway. Implement a simple line segment class with intersect method/s. Or google for one, I'm sure they're out there.