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 Payal · Jul 11, 2014 at 11:27 AM · augmented-reality

Triangle formed is still shown

I have three frame markers and there are three balls being shown above them.I have drawn a line between each two balls using lineRenderer thus forming a triangle. When I move the marker away from the camera view then the balls disappear(as should be) but the triangle is still displayed. How do I make the line also disappear when it can't find the ball or frame marker? I am coding in c# Please help guys Thanks :)

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 rutter · Jul 11, 2014 at 09:29 AM 0
Share

Disable the LineRenderer component, and it'll stop drawing a line.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Owen-Reynolds · Jul 11, 2014 at 03:35 PM

You're thinking about the problem the wrong way. The idea is for the human to think it's real, and that the lines wink out because it couldn't draw them. But, it's really just all faked, by you. There's no relationship to how easy something is in real life, to how hard it is for the computer to fake it.

You have code drawing three lines, connecting three balls. You want code for one line connecting two balls. Then, there are three possible pairs of two balls (AB, AC and BC,) so figure out how to make each of those lines.

Probably the 2-line code will be similar to the 3-line code, but simpler, or maybe not. Probably each of the connect-2-balls lines will be the same except for the variables. Or maybe not. There might be a nice way to combine all the code into one chunk the skips off-screen ball-lines. Or there might not be.

When you've got all three new 2-line codes written and tested, you just have to switch between them. If ball B goes off-screen, stopping running the 3-line code, and run the "make the AC line" code.

Comment
Add comment · 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
0

Answer by Tehnique · Jul 11, 2014 at 12:46 PM

As rutter said, you can disable the LineRenderer all together, or use .SetVertexCount(0) on it.

Comment
Add comment · Show 3 · 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 Payal · Jul 11, 2014 at 01:46 PM 0
Share

But I don't want all the lines to disappear.For example,if I remove one ball,then I still have two balls in the scene and a line should be drawn between the two.Only the lines for the removed ball should disappear. Thanks

avatar image Payal · Jul 11, 2014 at 01:46 PM 0
Share

disabling the line renderer removes all lines at once

avatar image Tehnique · Jul 11, 2014 at 02:01 PM 1
Share

Ah, well. When you remove the ball, call "SetVertexCount(number_of_remaining_balls)", then go through the remaining balls and call "SetPosition(ball[i].position)".

So for example:

 //You removed ball 3, and you are left with 2 balls, held in the generic list "balls".
 
 lineRenderer.SetVertexCount(balls.Count);
 for(int i=0; i<balls.Count; i++)
 {
     lineRenderer.SetPosition(i, balls[i].position);
 }



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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

NullReferenceException: Object reference not set to an instance of an object 3 Answers

Making the delay actually work 1 Answer

Cloud recognition in Vuforia 0 Answers

Unity OpenCV integration 1 Answer


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