Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Draw an orbital trajectory of a ship

$
0
0
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 ^^.

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>