- Home /
Question by
sarthaktodmal325 · May 20, 2021 at 04:09 PM ·
projectilespacesimulationtrajectoryprediction
how to draw trajectory of rocket for faux gravity in unity????
hey help me from 3 days i am searching on trajectory prediction for faux gravity but i found nothing , i am working on 2d space simulator game and i want to show the future position of the roket(want to show trajectory of rocket) with respect to the faux gravity of planet. this is code for gravity(need help for trajectory )
void FixedUpdate ()
{
Vector3 v = planet.transform.position - Player.transform.position;
float dist = v.magnitude;
Vector3 gdirection = v.normalized;
float G = Gconstant*(planet.transform.GetComponent<Rigidbody2D> ().mass * Player.transform.GetComponent<Rigidbody2D> ().mass) / (dist * dist);
gravityVector = (gdirection * G);
Player.transform.GetComponent<Rigidbody2D> ().AddForce (gravityVector, ForceMode2D.Impulse);
}
Comment
Your answer
Follow this Question
Related Questions
Trajectory Prediction with Particle Systems 1 Answer
2D projectile trajectory prediction 2 Answers
Increase velocity without changing trajectory 1 Answer
Simulating a trajectory that takes collisions into account 2 Answers
Projectile trajectory 1 Answer