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 beastsOnly · Jul 13, 2020 at 02:44 PM · linerenderer

Linerenderer: How to sample positions more frequently?

I am working on a project which consists of drawing a line, BUT, the most important thing is that I need to get the Y position on every X position. So, for every X I need a Y. Drawing a line and getting the positions works fine while I draw slowly. But when I move the cursor faster, even if the line gets drawn, the positions are not saved for every X, and this is a problem. You can just take a look at the image below. alt text As you can see, the green line is the one that Unity provides, LineRenderer. Just to prove my problem, I have drawn a circle at every position saved on the Line. So, even though the line gets drawn, I can't save my positions. Is there a way to solve this? Thank you and have a great day!

lines.png (4.4 kB)
Comment
Add comment · Show 1
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 unity_ek98vnTRplGj8Q · Jul 13, 2020 at 03:00 PM 0
Share

You likely won't be able to sample any faster than the framerate you are running at, so the only way to sample fast would be to increase your framerate (note that this will be faster once you build your project). You still won't be able to sample every position though... you may be able to somehow sample the mouse position faster using another thread or even some other application running separately from unity but I don't know how you would go about doing that exactly. Why do you need every x position? Why can't you interpolate between the sampled positions to give an approximate y value for every x position?

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by LHAppri · Jul 13, 2020 at 05:32 PM

How are you saving the positions? Graphics & interacting with the Unity objects is always time-consuming. If you constantly save the mouse positions as fast as possible, and then separately use that information to draw the line you should be able to get more positions, although your line drawing may "lag" behind the mouse a bit.
You are still unlikely to get all of the mouse positions though and so will have to interpolate the coordinates between them.

Comment
Add comment · Show 1 · Share
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 beastsOnly · Jul 13, 2020 at 08:34 PM 0
Share

After lots of changes around your solution seems to be the only way. But I don't get it, why is the line being drawn no matter how fast the cursor moves but the positions are saved so rarely. I don't do anything while drawing, only adding the positions to a list...

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

131 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I make a particle system follow a function? 1 Answer

How to configure a rope like joint 0 Answers

2D trajectory prediction around planets 1 Answer

How can I make the Line Renderer thinner than 0.1f? 0 Answers

Incorrect draw order with LineRenderer 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