Forum rules - please read before posting.

Draw a line that follows the movement of an object

Hello,
In my scene, I have the animation of a knife that lands on a board, tears it a first time, moves away from it a little and then tears it a second time.
I trigger this animation inside an ActionLists.
Now, I would like to draw a line that follows the knife when it is pressed, to show the hitch.
I searched and the Line Renderer component may be suitable? I created an empty Prefab with this component, but I don't really know how to use it afterwards to follow the knife, maybe a script is necessary?

Comments

  • Have a look at the Trail Renderer - it's intended for such situations.

    Both this and the Line Renderer are Unity components - if a script is necessary, it won't need to reference AC. However, see if the Trail Renderer is enough - it may be that it can do what you're needing without the use of any scripting.

  • Thank you very much, I placed the "Trait" GameObject as a child of Knife, with the Trail Renderer component and adjusting its parameters, the effect is exactly what I wanted !
    But on the other hand I would like the line to stop when the knife is not pressed and is moved in the air, and then resume when the knife is pressed.
    I will try to figure out how to achieve this result, maybe in the TimeLine ?

  • If you're using Timeline for the sequence, and the Trail is on a separate GameObject, you could try using Unity's Activation Track to enable it only while the sequence plays.

  • Thanks Chris.
    Indeed, that's what I did. The problem is that the stroke fades when the state is idle, which is normal. It would have been necessary to exploit the Emitting option of Trail Renderer I think.

  • You may be able to animate that property in an Animation track.

  • I struggled because I'm learning, but I got there.
    Thanks.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.