Per pixel, point, bounding box

For questions about using Classic.

Post » Sun Dec 28, 2008 10:43 pm

A few questions. I having some issues with collision detection, using the bullet/ turret behavior.
I'm guessing point means detection is by the image point, per pixel is by each visible pixel within a sprite, and bounding box is by the entire image, including any alpha channel.

First question, are they compatible? In other words can one object using bounding box, be used with another using point?

Second question, if you use point, will multiple points on one object register?

Third, why are some of my collisions, not being detected?
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Sun Dec 28, 2008 11:02 pm

[quote="newt":2jk5xq9i]First question, are they compatible? In other words can one object using bounding box, be used with another using point?[/quote:2jk5xq9i]
Yes. Bounding box and per pixel, for example, treats the bounding box as a big square opaque sprite when testing collisions with per pixel sprites. Try experimenting with some sprites and settings.

[quote:2jk5xq9i]Second question, if you use point, will multiple points on one object register?[/quote:2jk5xq9i]
Point means the hot spot only. This can be useful if you're using really small sprites and don't need per pixel collisions. Point against bounding box checks if the hot spot is inside the bounding box, and point against per pixel checks if the hot spot is overlapping a non-transparent pixel. Image points are ignored.

[quote:2jk5xq9i]Third, why are some of my collisions, not being detected?[/quote:2jk5xq9i]
I have no idea. Post a .cap or some more information and maybe someone will have a chance of being able to answer this!
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Mon Dec 29, 2008 12:02 am

Ok thanks
cap loaded here [url:167q5v2c]http://www.scirra.com/phpBB3/viewtopic.php?f=16&t=2232[/url:167q5v2c]

Now Im wondering if this might have something to do with the sprites sometimes overlapping as well.
I've found that bounding box works best for the rts movement, as you can give each sprite a little extra space by making the border larger than the actual image.. i.e. alpha channel larger than the sprite.
Unfortunately, that gives a problem when the bullets hit the bounding box, and seemingly disappear in midair.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Mon Dec 29, 2008 1:22 am

[quote="newt":r2hoyotj]that gives a problem when the bullets hit the bounding box, and seemingly disappear in midair.[/quote:r2hoyotj]
You could use separate sprites for the visible object and the collision-detecting bounding box - and test for bullet collisions with the visible object.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Mon Dec 29, 2008 1:45 am

Or just say "that's the invisible force field". :P
Thanks will give your way a try.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests