Pick nearest, AI pathfinding angles, rotation

Get help using Construct 2

Post » Thu Sep 25, 2014 8:06 am

Hi, I have a problem I just can't get my head around right now. I have a ball with a base, 2 resources to be collected and two blokes to do the collecting which will move around the ball's surface. I have the blokes moving to the correct angle but, they don't pick the nearest to them. What am I missing?

https://www.dropbox.com/s/idzqwkq0qmwvgzs/test-angle-ai.capx?dl=0
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Thu Sep 25, 2014 8:47 am

You have the bloke's and resource's origin points at the centre of the ball so they're actually all in the same place. They're all equal distance to each other.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Post » Thu Sep 25, 2014 11:28 am

So I have, thanks knew I missed something.
Maybe I should set it up to find the nearest based on image point or create a hidden object pinned to the resources and find that.
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Thu Sep 25, 2014 11:51 am

I tried an object pinned to the resource with the origin point set to the centre of itself and then tried to find the nearest to this object but, I'm getting the same results.

I thought It would be like this

1. find the position of bloke.
2. find the position of resource closest to bloke.
3. find the angle between each object.
4. rotate bloke until it's at the calculated angle.
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Thu Sep 25, 2014 12:06 pm

I see the problem now, the blokes origin is in the center so anything on the ball is going to be the same distance, I need a new way of looking at this :)
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768


Return to How do I....?

Who is online

Users browsing this forum: blue visionary, tarek2 and 13 guests