Answers for "How can i predict an Orbit?"
http://answers.unity.com/questions/1139532/how-can-i-predict-an-orbit.html
The latest answers for the question "How can i predict an Orbit?"Answer by Erethan
http://answers.unity.com/answers/1141946/view.html
Since your acceleration varies, position in respect to time formula is not that simple, However, you can do a trick to do the job.
You have it's start position and initial velocity.
From RealGravity * dir and mass, you can find acceleration in the direction of the planet in the launch. So if you consider acceleration CONSTANT for a small change in time, you can find the next position of your LineRender with the formula below;:
S = So + v*t + (a * a * t)/2
The method below will return the Vector3[] that you need to assign in your Line Renderer. You choose how many points you will need and how close they will be together from each other. Increase timeInterval for a better approximation
Vector3[] TrajectoryPrediction(int points, float timeInterval)
{
Vector3[] final = new Vector3[points];
final[0] = launch.position;
Vector3 considVel = initialVelocity;//You have this from the impulse force you would add
for(i = 1; i < points;i++)
{
final[i] = final[i -1] + considVel * timeInterval + (g* g) * dir * timeInterval;
//g should be a method like your RealGravity used only for this prediction. It will use final[i-1] as the object's position for the distance and it will be without rb.mass as it will be canceled out when a=F/mass
considVel = considVel + RealGravity * timeInterval;
}
return final;
}
*The script above is not optimized as I am using here to teach a conceptMon, 15 Feb 2016 05:07:55 GMTErethan