Object inside polygon

Discuss game development design and post your game ideas

Post » Sun Nov 23, 2014 8:10 am

Hi all,

I just tring polygon addon, and managed to create a polygon shape by click-drag mouse.
But how to check if an object is inside a polygon shape.
Thanks.
We're just a sprite in digital earth
B
9
S
3
Posts: 43
Reputation: 970

Post » Sun Nov 23, 2014 9:16 am

Hi @ramose73 Would overlapping suffice or does it need to be fully contained?
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Sun Nov 23, 2014 12:03 pm

Hi @hundredfold, it needs to be fully contained.
We're just a sprite in digital earth
B
9
S
3
Posts: 43
Reputation: 970

Post » Sun Nov 23, 2014 1:39 pm

What shape the object would it be? Is it any shape of polygon inside another or square?
B
34
S
9
G
3
Posts: 517
Reputation: 5,226

Post » Sun Nov 23, 2014 3:19 pm

Katala,

the polygon should be in freeform shape.
Sorry for not detailing my goal. I attach the concept of game I need to make.

User draw line around stars, then stars disappear. The line should be closed.
You do not have the required permissions to view the files attached to this post.
We're just a sprite in digital earth
B
9
S
3
Posts: 43
Reputation: 970

Post » Sun Nov 23, 2014 11:25 pm

Here every star has 10 imagepoints that need to overlap the drawn polygon.
You do not have the required permissions to view the files attached to this post.
B
34
S
9
G
3
Posts: 517
Reputation: 5,226

Post » Mon Nov 24, 2014 2:44 am

It might be enough to just check if the center of the star is in the polygon.

I made a capx a while ago that did that.
viewtopic.php?f=147&t=94377&p=732709&hilit=inside+polygon#p732709
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Mon Nov 24, 2014 1:04 pm

It might be enough to just check if the center of the star is in the polygon.

I also thought it should be enough.
B
34
S
9
G
3
Posts: 517
Reputation: 5,226

Post » Mon Nov 24, 2014 11:41 pm

Thank you @Katala and @R0J0hound !

That all works for me :)
We're just a sprite in digital earth
B
9
S
3
Posts: 43
Reputation: 970


Return to Game Development, Design & Ideas

Who is online

Users browsing this forum: No registered users and 2 guests