- Home /
How to show the objects movements by line or texture?
Hi all,
I need to do the object movements and i have done it.....but now i have to show the path of the object travelled in air... how to make it??? it is possible to draw line or doing with some texture ? we have to do any script for that ? Because i have done the movements with "Lerp". now how to draw the path... any help would be appreciated....
thank you.
Answer by sriram90 · Sep 16, 2011 at 11:49 AM
Just use "Trail Renderer" with you projectile...it'll be under Component -> Particles -> Trail Renderer...just add the component with the movable object and you'll see the object movements.
Answer by SilverTabby · Aug 26, 2011 at 04:55 AM
You have two built-in options to draw a line on the screen
The first is Debug.DrawLine. It's a single use function that draws one line on the screen, and only if this is a debug build (end user cannot see it). It's easy to draw a single line on the screen with no memory overhead, but It requires a bit of thought to work with, such as creating an array of points you want to draw lines between and going through it each frame.
The second is to create and use a LineRenderer. It creates a series of line in either 3d world-space or 2d screen space. It is more complex to get working at first, but after you understand how it works, it is very easy to draw complex paths though the world with a single object. This is an actual Object and will be in all builds of your project (the end user will always see it). It is an object that needs to be rendered every frame and fades from point to point if desired so it has a memory and rendering performance overhead.
Just save the initial position of your object and the end position of your object and pass those into the functions and it should work.
Debug.DrawLine and Pathrenderer showing the path Before the object get move. But i need to show it when the object movement through space.