Hi to all guys i am not good in physics and trigonometric I tried to do a projectile system.My launch point is higher than target point.I know the velocity v, target_distance d, gravity g,Launch_height_y y0.I added an attachment that shows the equation.I tried my own but not solved the equation.Please some one help me d = 30,v = 22 , g = 9.8 ,y0 = 2 I wants to find the theta(angle)
That is going to be a gigantic mess, especialy if you have more than one projectile being launched. Unity has not proven to be very efficient at upper level math (which is what that would turn out to be). I would reccomend using a rigidbody on the projectile and let Unity's built in physics solve whatever needs to be done. Maby some dynamic rigidbody.drag altering, but that would be about it.
It's pretty hard to predict where a projectile will hit, if no calculations are done beforehand. I guess if you would make an AI shoot back, you would need to at leas know what goes on behind the physX engine, so the enemy can hit you at all
i'm not great with maths but i thought you could find the angle by knowing the distance and initial velocity?
sure you can: http://en.wikipedia.org/wiki/Trajectory_of_a_projectile#Angle_of_reach How do you know this? You only have one arctan and one square root + a few multiplications to make this calculation. You can also always write your own solver to solve the 2 equations but better use the formula. The solver will be slower. [/code]