• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Jeffery25 · Jul 12, 2015 at 05:52 AM · trajectory

Most efficient way of turning collection of points into trajectory line?

Hello,

I have a collection of 3D points (in cm) that outline a trajectory very precisely; here is a an example:

25 -0.00443292 20.0768 / 25 -0.00791042 20.1371 / 25 -0.00981639 20.1702 / 25.0001 -0.0288575 20.5002 / 25.0001 -0.0292345 20.5072 / 25.0001 -0.029368 20.5096

Sometimes the points are further apart:

25 0 20 0 6 / 25 -1.811 51.4085 / 25 -4.80492 103.332 / 25 -7.88663 156.779 / 25 -12.5005 236.799

(These are stored in a several "Particle" classes which contains a list of points. So I'd access these with Particle.point[n].x for instance)

I want to visualize these trajectories in Unity; meaning I'd like to have two options:

1) to render the individual points (pixel wide or larger), and when they are numerous, I'd get the illusion of a full line; I'd like to consider the collection as one game object;

2) create the trajectory by connecting all these points with straight lines (pixel wide or larger), and once again considering the whole as one game object.

(Things I'd like to manipulate in the future: color and size of any part of those lines / of the whole line.)

The thing is, I have a lot of points; the order of magnitude is 10^5. There are also very many different trajectories to render at the same time. So what would be an inexpensive implementation?

Thanks! I am new to Unity, so I hope the question makes sense and is not too basic!

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image maccabbe · Jul 12, 2015 at 09:07 AM 0
Share

One option would be a mesh with a mesh topology of lines, line renderer, or points. Since you have 10^5 points and each mesh can only have 6.5*10^4 vertices you'll probably have to subdivide the collection.

http://docs.unity3d.com/ScriptReference/$$anonymous$$esh.SetIndices.html

http://docs.unity3d.com/ScriptReference/$$anonymous$$eshTopology.html

avatar image Jeffery25 · Jul 14, 2015 at 03:22 PM 0
Share

Thanks! This seems to work well with 2) using $$anonymous$$eshTopology.LineStrip, but when using $$anonymous$$eshTopology.Points the points don't appear on my screen... any ideas?

avatar image KazYamof · Jul 14, 2015 at 03:46 PM 0
Share

You could use GL.LINES to iterate in your array and to render the line composed by start point and end point. http://docs.unity3d.com/ScriptReference/GL.LINES.html

avatar image kolloldas · Jul 14, 2015 at 04:01 PM 0
Share

You could try the Line Renderer: http://docs.unity3d.com/$$anonymous$$anual/class-LineRenderer.html

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Missile Trajectory on a Sphere 1 Answer

Help with calculating 'Grenade' projectile trajectories 2 Answers

Trajectory Projectile with Collision Detection 2 Answers

Projectile Trajectory Velocity, with predefined Start and End Positions 0 Answers

Compare mouse trail/trajectory to given shape 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges