- Home /
Can trail renderer stop facing camera?
I want to try trail renderer face to Y axis not camera, but there is no setting value for me, Can I set trail renderer not face to camera? Or something instead it?
Thx.....
Answer by equalsequals · Jun 22, 2011 at 01:41 PM
I'm not sure I understand, but I believe you are misunderstanding the usage of the trail renderer.
The trail renderer generates a mesh at run-time that is effectively 2-dimensional (it has a width and height but no depth as it is planar)
So, by that logic, in order for it to be apparent in 3D space it always needs to face the camera (term: "billboarded"). This is done when the mesh is dynamically generated by the TrailRenderer component, so you don't have any control of telling it to do something otherwise.
From what I understand, you want is a dynamic mesh that behaves similar to a TrailRenderer, to follow a Game Object with a set amount of decay, but you don't want it to face the camera, but rather always face up. Is that correct? Leave me a comment and I may be able to point you in the correct direction.
[Edit]
Glad to see I understood. As Christian commented, you will have to create a component which essentially does the same thing as the Trail Renderer & Line Renderer, but instead does not dynamically orient the faces of the generated mesh to always face the camera.
In order to achieve something like this you will need to have reference to the object your custom trail renderer will be following. From there you will need to know your way around the Mesh class. You will probably be adding a new face to the mesh every frame, connecting the most recently created face to the transform of your target. You will likely also want to remove very old faces based on some level of decay.
Unfortunately I don't have time to mock up any pseudo-code or write examples but hopefully that's a push in the right direction for you.
Cheers
==
Yeah,you're right,but is there something a can do to create object like TrailRenderer but not always faces camera,face X,Y,Z axis ins$$anonymous$$d?
Thank you very much!
The TrailRenderer's "face-the-camera"-behavior is built-in and inherent to it. It shares this functionality with its sister, the LineRenderer as well. As you've discovered, there is no way to change this. You'll have to create a new trail renderer yourself that doesn't exhibit this behavior.
To equalsequals, I can think of a few reasons why you might not want the trail to face the camera. For instance, if you're making a Tron-like light cycle trail, this kind of functionality would be necessary.
I agree with your answer, but I was just pointing that out.
I never said that there weren't any reasons, I simply stated that he didn't understand the usage of the Trail Renderer component and what he wants to achieve is out of scope.
look at the Procedural examples on the Unity resources page. It has what you need, (TRON Trail).
Answer by HolBol · Jun 25, 2011 at 08:30 PM
Nope, is your answer. Look at the Procedural examples on the Unity resources page. It has what you need here, (TRON Trail). It works just like a trail renderer just without billboarding, so it twists and turns with the orientation of the gameobject it's on.
Your answer
Follow this Question
Related Questions
Unity trail render attached to rigidbody is jittery 0 Answers
How to make camera position relative to a specific target. 1 Answer
Stop trail renderer from terminating half-way into the camera. 2 Answers
Face tracking using Intel RealSense Depth Camera D435 in Unity 0 Answers
How to make remote player's healthbar GUI look at local player's camera? 0 Answers