Isometric trajectory or arc to hit target
BlitzMax Forums/BlitzMax Beginners Area/Isometric trajectory or arc to hit target
| ||
I need to do a 2D isometric (though not necessarily 45-degree oriented) trajectory calculation for the launching of a projectile to hit a target I click on with the mouse; think throwing a grenade in X-Com. Distance is always known. The program would need to perform calculations to find the angle and/or power or whichever is easiest - I'd not mind hardcoding or faking either as long as the result is that with gravity taken in account, the arcing projectile hits where I clicked. I checked out this link mentioned in a previous post in the Programming section, but I'm not clear on how exactly these concepts translate into code yet. The assumption is that the height of the launch would always happen from a constant height (say, 100) and the target would always be on a height of 0. Here's a simplified version of what I've been pissing around with, sans pages of commented-out experimental nonsense. If anyone can prod this code in the right direction then true awesomeness is yours forever. |
| ||
For reference: the red pixel indicates the location of the object on ground level (like a shadow), and white indicates the location of the object at its relevant height. |
| ||
incase you havent read this yet: http://blitzbasic.com/Community/posts.php?topic=68027 |
| ||
I have, and posted in it as well. It left me scratching my head. |