Data Realms Fan Forums http://45.55.195.193/ |
|
Calculating Trajectory? http://45.55.195.193/viewtopic.php?f=73&t=17709 |
Page 1 of 1 |
Author: | CaveCricket48 [ Mon Feb 01, 2010 12:38 am ] |
Post subject: | Calculating Trajectory? |
This doesn't quite fit in with Lua, but I didn't know where else to ask this. How do you calculate trajectory in CC, using the variables: 1. Initial X and Y position of projectile 2. Initial launch angle 3. Gravitational accleration 4. Initial X and Y velocity of projectile 5. Final X and Y position of projectile Edit: Forgot a variable. |
Author: | Dr. Evil [ Mon Feb 01, 2010 1:17 am ] |
Post subject: | Re: Calculating Trajectory? |
Heh. I'm working on the exact same thing. EDIT: Kind of. With or without air resistance? EDIT: Also, what output are you looking to get? Points of the arc, or the equation of the arc? |
Author: | CaveCricket48 [ Mon Feb 01, 2010 1:24 am ] |
Post subject: | Re: Calculating Trajectory? |
Points. |
Author: | Dr. Evil [ Mon Feb 01, 2010 2:34 am ] |
Post subject: | Re: Calculating Trajectory? |
Including air resistance, or not? |
Author: | CaveCricket48 [ Mon Feb 01, 2010 12:34 pm ] |
Post subject: | Re: Calculating Trajectory? |
It would be nice, but not a high "need" priority. |
Author: | ProjektTHOR [ Mon Feb 01, 2010 2:11 pm ] |
Post subject: | Re: Calculating Trajectory? |
This would be nice, because then I would assume lua-fied targeting reticles for NLOS weapons would be possible. Also, just checking but you already know the math to calculate parabolic arcs, right? You just need it in lua terms? |
Author: | Grif [ Mon Feb 01, 2010 3:58 pm ] |
Post subject: | Re: Calculating Trajectory? |
Solving for distance only (as in, assuming a horizontal surface) is actually pretty easy: θ=arcsin(rg/v^2)/2 angle = arcsin ( distance * gravity / velocity squared ) / 2 |
Author: | Abdul Alhazred [ Mon Feb 01, 2010 5:21 pm ] |
Post subject: | Re: Calculating Trajectory? |
I used this article to solve this problem for an actor in a mod I'm working on. It works fairly well even if the difference in Pos.Y between actor and target is a few hundred pixels. |
Author: | PhantomAGN [ Mon Feb 01, 2010 6:18 pm ] |
Post subject: | Re: Calculating Trajectory? |
This something like what you want? Attachment: The math has been heavily refined, but it deals with horizontal and vertical displacement. It's part of a lua-based mod I'm working (slowly) on. |
Author: | ProjektTHOR [ Mon Feb 01, 2010 8:08 pm ] |
Post subject: | Re: Calculating Trajectory? |
Seriously, can we see a NLOS targeting reticle now? |
Author: | p3lb0x [ Mon Feb 01, 2010 8:30 pm ] |
Post subject: | Re: Calculating Trajectory? |
I believe Capnbubs has something like that on his Crobo artillery crab |
Author: | Azukki [ Tue Feb 02, 2010 12:15 am ] |
Post subject: | Re: Calculating Trajectory? |
Obviously some room for improvement, but well done, phantom. I've got some suggestions for those improvements. It doesn't, and should, consider obstructions, and take the quicker trajectory by default when it's unobstructed. If both paths are obstructed, don't fire, I guess? Maybe you should try casting an obstacle ray of the same vector as the velocity at the position of the projectile every 100 milliseconds or so into the trajectory? Or something like that? Also, if you want it to be really a really smart mortar, when the target is a dynamic object, use target lead to fire where it's going to be when the projectile strikes, rather than where it is now. Maybe also add the initial velocity of the turret to the projectile, and consider that? And consider air resistance, and lifetime of the projectile. This would pretty much make a perfect AI aiming system. But that's a bit overkill for one mod. For data, implementing it into the entire game would be great though. Considering obstruction would be reasonable for it though. |
Author: | PhantomAGN [ Tue Feb 02, 2010 1:31 am ] |
Post subject: | Re: Calculating Trajectory? |
It actually already does the math for both possible paths and choses the faster one, all in one pile of calculations. You're right about the obstacles though. Air resistance is ignored because the projectile itself just ignores it too. It would not be hard to work in. The turret's not supposed to move, but the mod does include a portable version. I'll have to do some more math to fix that, you're right. |
Author: | Mind [ Tue Feb 02, 2010 7:16 pm ] |
Post subject: | Re: Calculating Trajectory? |
Piipu already did this with grenades. It's somewhere in Epic CC Moments. Just sayin |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |