- Home /
Draw an orbital trajectory of a ship
Hi guys i'm working on a game in which it will be possible to take a spaceship to go between differents planets. I already have a Sun with some planets turning around with a simple script :
#pragma strict
var rotation : Quaternion;
var radius = Vector3(5,0,0);
var degrees:float = 10;
var moonCurrentRotation = 0.0;
var planete : GameObject;
function Update(){
moonCurrentRotation += degrees*Time.deltaTime;
rotation.eulerAngles = Vector3(0, moonCurrentRotation, 0);
transform.rotation.eulerAngles = Vector3(0, moonCurrentRotation*30, 0);
transform.position = rotation * radius + planete.transform.position;
}
I have an other script which implement circular gravity so i can walk on the planet, take of, make an orbit and go to the moon (on foot ^^). So my problem is to draw the trajectory line of my ship where we can find the apoapsis and periapsis. In fact i would like to make something similar as you can see in Kerbal Space Program. I'm a beginner and i don't know what to do at first. I know a little bit mechanics but i don't know how i can use it for tracing a trajectory.
Thanks in advance for answers and excuse me for my english i'm french ^^.
Thanks for the answer !
Is there free solutions to make something similar without using vectrosity ? The most important for me is to make the possibility for the player to make manual space flying at his own risks, and an automatic secure fast flying mode. The trajectories would be implemented in the player's radar and would be used just for the free mode. Automatic mode would be used for fastest travels ; i don't want to make a "wrap time" mode like $$anonymous$$SP. I just want to make an adventure game and not a simulation.
Please don't post a comment/follow up/thank you as ANOTHER answer as you did here, I changed this one for you.
Answer by le_duke · Mar 15, 2014 at 10:00 PM
I think that this is gonna help you ;) : http://docs.unity3d.com/Documentation/Components/class-LineRenderer.html
Your answer
Follow this Question
Related Questions
how to DrawPath Trajectory Like below game Reference 0 Answers
How to predict orbit based on time? 1 Answer
How will I draw a curve that represents the trajectory of a projectile? 1 Answer
Aim preview for projectile trajectory 1 Answer
Simulating 2D planetary gravity and trajectpry using Unity 0 Answers