I have searched high and low for an answer to my question but to now avail so here goes:
I have a project to create a solar system, that is planets rotating around a cetral sun. Nothing realistic mind you, just spheres moving around a point in random ellipses, no gravity or physics involved.
As the planet's trajectories are randomised at runtime I was hoping to draw their trajectories... Is there a simple way to do this? I have looked at gizmos, linedraw and trail functions but none of them have the functionality Im looking for:(
Any suggestions? Maybe im going about this the wrong way, Im really not very experienced at this.
What functionality are you looking for? You haven't actually described what you want.
Answer by Mike 12
Dec 01, 2010 at 10:54 PM
TrailRenderer wouldn't do the trick for you? It'd be easier for people to help you if you told us what kind of functionality that you were looking for. Because, there are ways to go about drawing the trajectory of an object in Unity that you might like.
If you want the trajectory to be drawn after the object has passed that point, then you could just attach a TrailRenderer to our planet. However, if you want to draw the trajectory from the beginning, then I suggest that you store your trajectory in an array and implement your trajectory line as a LineRenderer object.
Answer by Bob5602
Dec 01, 2010 at 02:34 PM
Do you need the trajectories completely, or just a trail after the spheres as they move? If its just the trail, I could suggest using some sort of particle emitter on the spheres to leave little specks as it moves, creating a trail with the traveled trajectory.
Answer by Rennat
Dec 01, 2010 at 05:59 PM
I might approach this problem by creating a ring texture with an additive particle shader, placing it on a plane and then aligning/scaling that plane to match the orbit of the planet. (Depending on the screen size of the orbit this may or may not look good)
Or you could create a circle using short LineRenderers
Or if you set a TrailRenderer's duration to the same period of time as a planet's "year" then set the trail not to fade out (full alpha in the colors) then it should simulate this after the first orbit.
Answer by Tuti
Dec 01, 2010 at 06:08 PM
I would put a "fake" and invisible planet moving faster than the actual ones. Then you assign a "Trail Renderer" particle system. They would draw a path that you are looking for.
Tuti answer would be the lightest performance one.
Not so much 'faster', but in front of the others. Not so sure about the performance issue though. Also, Necromancy.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
3 People are following this question.
Lines or curves for a smooth circle in Vectrosity
Draw a line via script and make a solid with it..
Drawing a glowing line from one point to another on update
Line Renderer and Collider Question
How to move an enemy on a curvy line?