Leading Targets

Get help using Construct 2

Post » Fri Jun 08, 2012 10:27 am

Hi, this is one that has been giving me a headache. If anyone knows what it's called and I've missed the post please just tell me the name, but here's the problem anyway.

Here's the simplified version.
There's a slow target object moving through space at a randomly created but constant speed in a straight line.
I have an 'smartcannon' that will fire a projectile at this object whenever the player presses a button. The projectiles always go the same speed and in a straight line.
I want the projectiles to always hit these targets, but to do so only by changing the angle that it is fired at.

I've been trying to work out the Trig to predict a line ahead of the target and picking where the projectile will need to intersect to hit it but both the distances and times scale together.

I know the distance between starting points once the player hits the fire button and know they have to hit at the same time (given distance = time * speed)

Also I'm *really* trying not to give up and use point defense lasers or heat seeking missiles.
B
21
S
7
G
3
Posts: 33
Reputation: 4,522

Post » Fri Jun 08, 2012 11:16 am

There's definitely a way to do this, you're probably just missing the algorithm a bit. Perhaps some of our math geniuses can help ;)
This would be nice for the FAQ, anyway.sqiddster2012-06-08 11:16:22
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Fri Jun 08, 2012 11:33 am

@Ashley implemented this in CC as an expression.
The cap(not capx) attached in the link explains how it all works.
Might see if Ashley would add it to C2.

predictive aiming
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Sat Jun 09, 2012 6:09 am

Thankyou so much Newt, I'm downloading construct 1 now to have a look. I thought that was too fundamental to not have been tried before.
B
21
S
7
G
3
Posts: 33
Reputation: 4,522

Post » Sat Jun 09, 2012 9:41 am

I decided to convert Aproximative Aim from .cap to .capx so i guess it had a bug, i think someone already reported it about angle.

http://flamma-beta.com//HTML5/aproxaim.capxJoannesalfa2012-06-09 09:42:15
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644


Return to How do I....?

Who is online

Users browsing this forum: kamens503, Yahoo [Bot] and 26 guests