Donate Share

Construct

Tracker: Bugs

5 Per Point collision inaccurate at times. - ID: 2809988
Last Update: Settings changed ( ashleysbrain )

After wrestling with why my box in a game wouldn't go exactly against a
wall in Construct (it stops a pixel away from it), I've come to realise it
has to do with Per Point collision detection. It seems it doesn't actually
do it per visible point, but extends itself a little further. I've written
more about it in the attached .cap-file.

It will get really ugly in something like a pixel-graphics game when it
does this. I'd prefer to be able to use per point because of the way I've
worked before rather than settle for bounding box; it would greatly help if
this was fixed...


Joakim Sandberg ( konjak ) - 2009-06-21 20:46

5

Closed

Fixed

Ashley

Collisions

Bug report

Public


Comments ( 9 )

Date: 2009-11-04 21:05
Sender: ashleysbrainProject AdminAccepting Donations

Appears fixed in next build.


Date: 2009-06-22 20:29
Sender: konjak

Cool.

Well yeah, my long, confusing paragraph before was trying to say that
thing about both suddenly touching when the line is bounding box!


Date: 2009-06-22 20:07
Sender: therealdeadeye

Hello!

Sorry to butt in, but here's your problem:

http://files.getdropbox.com/u/529356/obstangle.cap

Yes, there seems to be a bug. But it appears to be a combination of
per-pixel collision and the angle to which the obstacle is set.

SOMETHING WEIRDER:

Change the obstacle's collisions to Bounding Box. BOTH of the blue boxes
turn transparent for the rotated obstacle! THE MYSTERY DEEPENS


Date: 2009-06-22 19:09
Sender: konjak

Just an update: I made an entirely new box within my game and collided it
with a 90° upwards wall and it does the same one-pixel thing.

Something's gone wrong in my CAP, but it's not in events.


Date: 2009-06-22 18:55
Sender: konjak

But this just points to inconcistency in the bug. In your CAP you've just
done exactly the same thing I did, and in mine it somehow touches the wall.
It can't possibly be my code then, can it?

In my second example I cloned the green box to make the blue one that
touches the wall and it shares no events to the green box, it just has the
transparency code. I tried changing the red lines I use to bounding box in
case they created some slightly larger collision box, but then it turns
both transparent which means at THAT point it gets a collision box larger
than the "box". Note that the red line in my example is 90° from its
actual image.

I even tried removing all events in my perpixel.cap except for the one
where the blue boxes test for the wall, and I get the same bug.

Either this has to do with angled sprites, certain images sizes, resized
sprites, just being random, or all of the above. When I remove everything
but that one event making the box transparent, I can't imagine it's my code
in any way.




Date: 2009-06-22 18:20
Sender: ashleysbrainProject AdminAccepting Donations

I've uploaded a new file demonstrating there is no bug. I still think it's
a problem in your original .cap's events. What do you need to modify in my
file to make per-pixel collisions not work?


Date: 2009-06-21 22:34
Sender: konjak

http://www.konjak.org/perpixel.cap

Here, further proof, and I made this test in seconds.

Two of the same sprite at the same X right up against a wall. If either
overlaps an event says to make it 50% transparent. The one sprite with "per
pixel", though it doesn't visibly overlap, turns transparent!

It's not my code.


Date: 2009-06-21 22:26
Sender: konjak

But it's fixed by changing to bounding box... ?


Date: 2009-06-21 22:24
Sender: ashleysbrainProject AdminAccepting Donations

As far as I know the per-pixel collisions are working fine. To prove that
it's not working you just need to put two objects in a layout and show that
an 'is overlapping' condition is either falsely running or not running.
Looking at this .cap, I'm inclined to think it's simply a mistake in your
events: either it's jumping more than one pixel a tick and is stopping a
pixel early, or there are rounding errors in floating-point calculations
and the result is off-by-one - either way, something to fix in your events.


Attached Files ( 2 )

Filename Description Download
perpixel.cap Per Point collision inaccurate Download
collisiontest.cap File demonstrating no bug, 0.99.3 Download

Changes ( 9 )

Field Old Value Date By
status_id Open 2009-11-04 21:05 ashleysbrain
close_date - 2009-11-04 21:05 ashleysbrain
resolution_id None 2009-11-04 21:05 ashleysbrain
status_id Pending 2009-06-22 20:29 konjak
close_date 2009-06-21 22:24 2009-06-22 20:29 konjak
File Added 331957: collisiontest.cap 2009-06-22 18:20 ashleysbrain
status_id Open 2009-06-21 22:24 ashleysbrain
close_date - 2009-06-21 22:24 ashleysbrain
File Added 331829: perpixel.cap 2009-06-21 20:46 konjak