Circular collision masks for non-physics objects?

Discussion and feedback on Construct 2

Post » Wed Feb 08, 2012 1:41 pm

For me is because of precision issues that varies depending on the rotation of the object and aggravates through scaling.

I started using the physics behavior and it's circular collision, but since it lacks the feature to disable collisions in runtime I decided to do my own movement through events. Now the problem is not the inability to disable collisions anymore, but the fact that I can't check for circular collisions.

In another project is a different situation. I used the physics behavior with circular collision and test for collisions with other objects to apply forces. The problem is that when you use Is Overlapping or On Collision it checks for collision using the sprite's collision polygon, but in the same time the physics behavior is using circular collision to interact with other objects. This difference between the collision models, where the space the object occupies is different than the check space, generate errors and unexpected movement.

Anyway, just wanted to make you aware of the problems I'm having.
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Wed Feb 08, 2012 1:49 pm

A circular collision mask is the same as calculating distance from the center of the object (you can offset this, obviously).

If a point's distance relative to your object is less than the radius of the "circle mask" (which isn't really a mask, just an imaginary concept), that point is colliding with the object.

I could probably make a behavior to make objects "collide" with perfect circle masks, but it would be an ugly hack and it would probably be computationally expensive for multiple objects. PM me if you really need this urgently and can't implement it via events.Fimbul2012-02-08 13:50:07
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Wed Feb 08, 2012 5:15 pm

Well, you can also test the distance between objects with events: distance(a.x, a.y, b.x, b.y) < 100
but I understand that's not very convenient. It's on the todo list, but it gets a bit tricky with things like poly-circle and circle-poly collisions.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,528

Post » Wed Feb 08, 2012 7:47 pm

[QUOTE=Ashley] Well, you can also test the distance between objects with events: distance(a.x, a.y, b.x, b.y) < 100
but I understand that's not very convenient. It's on the todo list, but it gets a bit tricky with things like poly-circle and circle-poly collisions.[/QUOTE]
hence the "ugly hack" part (if I were to make this as a plugin)Fimbul2012-02-08 19:47:41
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests