x


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.....

more ▼

asked Jun 22 '11 at 12:55 AM

Suyuanhan gravatar image

Suyuanhan
188 49 53 55

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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

==

more ▼

answered Jun 22 '11 at 01:41 PM

equalsequals gravatar image

equalsequals
4.5k 16 28 64

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 instead?

Thank you very much!

Jun 23 '11 at 05:23 AM Suyuanhan

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.

Jun 23 '11 at 06:35 AM CHPedersen

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.

Jun 23 '11 at 02:38 PM Jason B

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.

Jun 25 '11 at 03:09 PM equalsequals

look at the Procedural examples on the Unity resources page. It has what you need, (TRON Trail).

Jun 25 '11 at 03:17 PM Fishman92
(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Jun 25 '11 at 08:30 PM

Fishman92 gravatar image

Fishman92
2.4k 101 113 128

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3121
x48
x33

asked: Jun 22 '11 at 12:55 AM

Seen: 2409 times

Last Updated: Jun 25 '11 at 08:30 PM