[Request] Circular Collision Boxes

Discussion and feedback on Construct 2

Post » Wed May 22, 2013 2:17 am

I would like to request an option to make the collision box of a sprite circular. Often I make a bullet object that I expect bullets to bounce off walls at same angle as they hit the wall. Normally, he only way to do this would be to add a whole heap of collision points, which lags up the game. Do you see what I mean?Tantusar2013-05-22 02:44:08
B
7
S
1
Posts: 4
Reputation: 1,143

Post » Wed May 22, 2013 7:14 am

You want a round pixel ?...good luck with that one...
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Wed May 22, 2013 7:24 am

Physics behavior does have round collision boxes, found in the behavior properties, not the animation editor.
B
200
S
51
G
30
Posts: 896
Reputation: 36,494

Post » Wed May 22, 2013 12:14 pm

You don't need circular collision masks for that. See the 'bouncing bullets' example.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Wed May 22, 2013 10:41 pm

Having a circular mask would do nothing at all to help. For reference, circular "masks" are the easiest to program because you can just check the distance to another object, and when the distance is smaller than the radius of your circular collision mask, you have collided (it's a bit more complicated than that but you get the gist).

What I would love to see, @Ashley, is a way to get the normal of a surface, or at least the angle between two points in the mask, so I can make perfect collisions - since this is a bit of an obscure request, perhaps you can point me to the SDK so I can implement this myself? Is this even possible?
Think of a laser beam hitting an irregular (as in, arbitrary shape) mirror - the reflected beam's direction depends on where it hit the mirror. Since the shape is arbitrary and I cannot fetch any data about the collision mask, it cannot be implemented (unless you use weird hacks).
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Thu May 23, 2013 12:51 am

Take a look at the Javascript SDK. Unfortunately there's no documentation on the collision masks, but the source code to the engine is viewable in the install directory. If you look up the Bullet behavior there's a function to get the angle of collision for an arbitrarily shaped object which might come in handy.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468


Return to Construct 2 General

Who is online

Users browsing this forum: anty21ro, mystazsea, nimos100 and 10 guests