Page 1 of 1

Shape:testSegment

Posted: Sat Jan 12, 2013 4:14 am
by chi
I was wondering if there's any alternative to Shape:testSegment for Love versions 0.8.0 or later.

I was planning on using this function to determine if there was any obstacles or other enemies between an enemy shooting and it's target. Mainly, I don't want enemies shooting other enemies, so I want to check if there's any obstacles, namely other enemies, in their line of fire before shooting. So far, all enemies, players and obstacles are implemented with love.physics, so there are shapes, bodies and fixtures for them all.

Is this a good idea? Or should I consider some alternative methods for this type of checks?

Re: Shape:testSegment

Posted: Sat Jan 12, 2013 6:21 am
by substitute541
Love.physics is overkill for simple games. I'd suggest alternative methods of doing that. You can test for intersections using a line intersecting test function in the love2D wiki's snippets. There are lots of other alternative methods so you should try one that suits you the best.

Re: Shape:testSegment

Posted: Sat Jan 12, 2013 3:00 pm
by slime

Re: Shape:testSegment

Posted: Sat Jan 12, 2013 6:44 pm
by chi
slime wrote:World:rayCast
Thanks! This was exactly what I needed!