Leading Targets

0 favourites
  • 5 posts
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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

  • 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.

  • 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.capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)