Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 Ekta-Mehta-D · Jul 28, 2014 at 05:19 AM · linepointdraw

Draw line from one point to another using mouse

Hello everyone..

I have scene like points will be generated randomly and i want to draw line in between those points.

So if i touch on any of the point i want to start that line and line should be drawn till i reach to the another point. Thats the way i want to draw line.

And if i could not be reached to another point then line should not be drawn.

Line should not overlap each other and new point also we can add by dragging line . How can i achieve this ??

Thanks to all for your help and support till now..

Comment
Add comment · Show 3
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 robertbu · Aug 07, 2014 at 06:28 AM 1
Share

You bumped this, so I'm assu$$anonymous$$g you are still looking for an answer. Right now this question is too vague with multiple issues. You need to break your problem into individual issues:

  • How to display a line

  • How to connect points with a line

  • How to display the points

  • How to randomize the placement of the points

  • How to detect a near point to connect a line

  • How to avoid overlapping a line (can two segments share a point? Can a segment cross another line segment?)

  • How to select a line

  • How to drag a line

I'll give a bit of feedback on one aspect of your question: drawing lines. There are multiple ways of drawing a line, all with their strengths and weaknesses, and many are not very simple. Here is a partial list.

  • LineRenderer

  • Use real world objects line Quads or Cylinders

  • GL class

  • CustomLineRenderer

  • Vectrosity

The last one, Vectrosity, is a paid-for script in the Asset Store. You could draw all of your points and all of your lines in a single drawcall, and there is a bit of starter script that draws a line by clicking with the mouse.

avatar image sudhir_kotila · Aug 07, 2014 at 07:06 AM 1
Share

Download Code From Here

Here I m giving a code for draw a line through mouse. It will deferentially worked.

line drawing through mouse.zip (127.2 kB)
avatar image Ekta-Mehta-D · Aug 09, 2014 at 11:27 AM 0
Share

Thanks @robertbu

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.

Follow this Question

Answers Answers and Comments

24 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Drawning Line Problem useing custom class 1 Answer

How would I replicate Gizmos.DrawLine in-game? 1 Answer

A node in a childnode? 1 Answer

Need Help with How to make a Game like Canvas rider... 0 Answers

interesting raycast question 2 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