Comments and answers for "Aim preview for projectile trajectory"
http://answers.unity.com/questions/156571/aim-preview-for-projectile-trajectory.html
The latest comments and answers for the question "Aim preview for projectile trajectory"Answer by jyounger
http://answers.unity.com/answers/157603/view.html
Actually, I take it back. After looking at the Rochard trailer again, it seems that the trajectory being drawn and the actual flight path of the boxes being shot are in fact a parabolic trajectories that don't take drag into account.
I've talked to two math guys about this (including the fellow who made that physics applet I linked to) and I've gotten two different answers, neither of which has worked out very well:
X = initialVelocity*cos(initialAngle)
Y = initialVelocity*sin(initialAngle)
loop N points times(
X = X - (1/2) * drag * (velX*velX) * tStep/mass
Y = Y - (1/2) * drag * (velY*velY) * tStep/mass - grav*tStep
)
and
X = X + mass/drag*initialVelocity*cos(initialAngle)*(1-e*(-drag*tStep/mass))
Y = Y + mass*gravity/drag*tStep+mass/drag*(initialVelocity*sin(initialAngle)+mass*gravity/drag)*(1-e*(-drag/mass*tStep))
The first one actually works a bit better, though drag appears to only be affecting things in a leftward direction. It's hard to tell though because the gravity is behaving very strangely and seems to change directions depending on the initial angle.
The second one doesn't seem to even begin aiming in the proper direction, which at least the first one does.
Man, why is this so hard :(Wed, 17 Aug 2011 19:28:57 GMTjyoungerComment by jyounger
http://answers.unity.com/comments/156587/view.html
Okay, I've done a little research on the matter and it seems that I have all the information available to me that I need in order to calculate the trajectory properly.
Apparently all that is needed is the initial velocity, the mass, the angle of launch, the drag, and the acceleration of gravity. All of these are know at any given time. The question is, how to actually do the calculation. If someone could explain I would appreciate it.
I also understand that I should be populating an array of points based on this calculation, using some arbitrary time step. I can then connect the dots, so to speak, in order to draw the path of the trajectory. That actually seems like the easy part. I just need the basic formula for calculating the trajectory.
As an example, this applet is doing EXACTLY what I need to do:
http://www.rabidgeek.net/physics-applets/projectile-motion/
All I need is the method they're using :)Mon, 15 Aug 2011 06:58:09 GMTjyounger