1
Ask a Question / Re: Ballistics / Curves
« on: June 19, 2012, 07:26:10 am »
Ah, ofcourse, i should have been able figured that out myself haha! Thanks alot for clearing it out!
I tested it out, and it works like a charm! Cheers!
Would it be possible to alter the initial angle to be higher, say, -90 degrees (straight up?). I played around with the numbers a bit, but cant seem to solve it.
My old calculation was basically the same (without the curving ofcourse), setting the velocity between the two points using atan2. I guess its somewhat heavy to calculate every frame, but i cant find a more lightweight approach.
Thanks again! You saved me from the headaches!
Code: [Select]atan2[([y of enemy] - [absolute value of ([x of self] - [x of enemy]) - [y of self]) ([x of enemy] - [x of enemy])]
meaning - it takes distance in x and distance in y and decrement y by the absolute value of distance in x.
This may indeed need more time to calculate. How do you calculate bullets motion currently (I mean without the curve)?
I tested it out, and it works like a charm! Cheers!
Would it be possible to alter the initial angle to be higher, say, -90 degrees (straight up?). I played around with the numbers a bit, but cant seem to solve it.
My old calculation was basically the same (without the curving ofcourse), setting the velocity between the two points using atan2. I guess its somewhat heavy to calculate every frame, but i cant find a more lightweight approach.
Thanks again! You saved me from the headaches!
