New Collision Mode: Angled Bounding Box

New releases and general discussions.

Post » Sat Oct 16, 2010 12:49 am

right now, if you have a thin rectangle turned at a 45 degree angle
per pixel is a waste of resources, especially if the object is very large
but bounding box, creates a non angled box that encompasses the entire diagonal object
and has no practical use whatsoever in most situations, but is very fast
I think the ability to have a bounding box that would enclose the original sprite, basically the box you see in the picture editor, that will turn with the object's angle, and scale with it
would be much quicker than per pixel, and be extremely useful in many situations
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sat Oct 16, 2010 11:36 am

Good feature, sign me in petition. Right now have this situation (need 45 degree angle LOS obstacle for wall)
B
19
S
6
G
4
Posts: 171
Reputation: 2,507

Post » Sat Oct 16, 2010 12:12 pm

Couldn't you get a dummy hit box to do that for you?
Like if sprite angle = 45 dummy set frame to frame 2, or for something a little more accurate, you could set up the dummy to set its height and width via multiple image points from the host sprite.
dummy set height to distance(imagepointX("top"),imagepointY("top"),imagepointX("bottom",imagepointX("bottom"))...?
Ok dunno if that will work haven't tested it.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Sat Oct 16, 2010 7:06 pm

not sure what you mean, and in any case, that sounds like alot of work for what should be as simple as clicking an option in a dropdown menu
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sun Oct 17, 2010 5:41 pm

[quote="newt":2zvqn9ea]Couldn't you get a dummy hit box to do that for you?
Like if sprite angle = 45 dummy set frame to frame 2, or for something a little more accurate, you could set up the dummy to set its height and width via multiple image points from the host sprite.
dummy set height to distance(imagepointX("top"),imagepointY("top"),imagepointX("bottom",imagepointX("bottom"))...?
Ok dunno if that will work haven't tested it.[/quote:2zvqn9ea]

What do you mean by dummy hit box? The whole point of this is for the box collision mask to rotate with the sprite, so there aren't huge corners of nothingness that can trigger collisions in rectangular-ish rotated objects. A dummy hitbox would use an extra object, and would have to use per pixel collisions anyways, since it's the only type of collision mode that works with rotated sprites. The whole point is so you can better benefit from the performance savings of box collision mode.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sun Oct 17, 2010 7:11 pm

Sorry, I wasn't talking about rotating the hit box.
This cap kinda shows what I mean, not exactly perfect tho.
[url:2kehn18d]http://dl.dropbox.com/u/666516/resizehitbox.cap[/url:2kehn18d]
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Sun Oct 17, 2010 9:52 pm

[quote="Davioware":36utus36]What do you mean by dummy hit box? [...] would have to use per pixel collisions anyways, since it's the only type of collision mode that works with rotated sprites.[/quote:36utus36]

For a dummy hitbox, use a box. It rotates and does not use per-pixel collision, as it has no pixel definition.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Tue Oct 19, 2010 8:37 pm

This is a good idea for C2, but per pixel isn't much of a waste of resources. At 1 bit per pixel for a collision mask you're only using 128kb of memory for a 1024x1024 object, on machines which these days typically have well over 1gb physical RAM going spare.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Tue Oct 19, 2010 9:54 pm

if you have large moving sprites for platforms, per pixel causes major slowdown
I don't think 1024x1024 is impractically large for a modern hd game, but look at this cap
runs fine
toggle the action that rotates the sprite, and it causes major slowdown on my system, which is not top of the line, but fairly up to date:
bounding box collision: 9300 fps
per pixel: 25 fps

AMD Phenom II X4 965 Black Edition Deneb 3.4GHz

4GB 1333 (PC3 10600) Dual Channel

Radeon HD 5870 1GB
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Wed Oct 20, 2010 2:35 am

[quote="Ashley":26mfloty]This is a good idea for C2, but per pixel isn't much of a waste of resources. At 1 bit per pixel for a collision mask you're only using 128kb of memory for a 1024x1024 object, on machines which these days typically have well over 1gb physical RAM going spare.[/quote:26mfloty]
I think he means processing time, which is significantly larger for per-pixel than bounding box.

Did you try dummy box objects? they are *exactly* what you're looking for.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 6 guests