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 laCarr41 · Jun 12, 2013 at 10:26 PM · c#componentdrawactivatetrail renderer

Activating and de-Activating trail Renderer

I am trying to make a pen which writes with a trail renderer when the tip of the pen is colliding with the paper. When the pen is not on the paper I want it to stop the trail renderer, but at the same time keep the lines it previously made.

Is there any way possible where I can de-Activate the trail renderer on my object but keep the lines that it previously made?

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

3 Replies

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

Answer by laCarr41 · Jun 13, 2013 at 05:44 PM

Ok well, I did not figure out how to do exactly what I Originally asked, but I did a little magic trick instead. I have two objects, The first is a Pen which is above the drawing surface, The second is the Pen tip which is under my drawing surface. When the Pen gets closer to the drawing surface from above, the Pen tip get closer from the back. Eventually the pen tip with the trail renderer becomes visible and it looks as if the pen is drawing. I know that this has some flaws and will not work if your surface is not wide enough to hide the Pen.

This does not deserve to be the correct answer to my problem, but it is more of an alternative solution.

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 Hyperion · Jun 13, 2013 at 05:47 PM 0
Share

Hey, that's pretty cool! I hope you're successful.

avatar image
0

Answer by Hyperion · Jun 13, 2013 at 12:45 AM

Well, I mainly only have a solution to 1 part of your question. That is to keep trail. All you need to do basically is make the time variable very very high or put 'infinity' there (at least infinity should work...although I haven't tried it yet). Also if you haven't done so, might I suggest making the MinVertexDistance very low as well, since that makes the trail smoother.

As for the second issue, you could try something like the following adapted to a trailrenderer.

 gameObject.GetComponent(ParticleEmitter).emit= false; //tell the emitter to stop
Comment
Add comment · Show 6 · 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 laCarr41 · Jun 13, 2013 at 01:47 PM 0
Share

Thanks! Helped a lot. Still need a little help with the second part. Is there any other way I could accomplish this task other than using a trail renderer?

avatar image Hyperion · Jun 13, 2013 at 05:42 PM 0
Share

You're welcome. Hmm..... There are multiple ways of doing this. You could give the paper animations that give it ink (basically change the texture every second) and fake the pen writing, but that's really hard...

OH got an idea! You could use a simple particle emitter at the tip of the pen/ the part that writes. The particles should not follow the pen so if you move it around, they'll stay. Plus you can make the particles look like ink. Unity's particle emitter has a function called Pause. So that might be able to solve your second problem.

avatar image laCarr41 · Jun 13, 2013 at 07:41 PM 0
Share

Thanks for all of the ideas. If I run into trouble with my solution, I'll look into your solution. If you or anyone wanna know more about what I did send me an email and I'll get my code posted up.

avatar image Hyperion · Jun 14, 2013 at 01:04 AM 0
Share

Cool! Also, could you please help me with a question of $$anonymous$$e called something like 'Run to walk issue'? I would really appreciate it.

avatar image laCarr41 · Jun 14, 2013 at 03:47 PM 0
Share

I will take a look at it, but I am very new to unity, so I will do my best!

Show more comments
avatar image
0

Answer by Dominic12 · Oct 07, 2018 at 03:30 AM

I wanted to disable the renderer when not using an attack so i just changed the width to zero. Example:

private TrailRenderer tr; void Start () { tr = GetComponent(); }

 void Update () {
     if (Input.GetKey ("w")) {
         tr.widthMultiplier = 0.0f;
     }
     if (Input.GetKey ("1")) {
         tr.widthMultiplier = 3.0f;
     }
 }
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

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

16 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

Related Questions

Distribute terrain in zones 3 Answers

How to activate/deactivate a component(Animator) when a specific game object was activated 0 Answers

Multiple Cars not working 1 Answer

Verify if a Component is null 3 Answers

C# How to Check If a Gameobject Contains a Certain Component 6 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