x


Can I make a billboard plane on terrain tree prefab?

I made a plane in Max and painted a tree with an alpha on it. I painted that tree (plane) on the terrain layer. I want it to have billboarding to always see my 3rd person game cam. Can this work with the terrain like that?

This is what i used as a script that i threw in the tree prefab:

function Update()

{ transform.rotation = Quaternion.LookRotation(Camera.main.transform.up,Vector3.up); }

The code I have isn't working though.

I also tried this with no luck:

function Update()

{ transform.rotation = Camera.main.transform.rotation; }

more ▼

asked Mar 23 '11 at 09:56 PM

GreenHat gravatar image

GreenHat
3 6 6 7

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

3 answers: sort voted first

Did you try the Billboarding script from the script wiki?

more ▼

answered Mar 23 '11 at 10:18 PM

DaveA gravatar image

DaveA
26.4k 151 171 256

Okay, just tried that script: http://www.unifycommunity.com/wiki/index.php?title=CameraFacingBillboard I tried to drag and drop the script into the tree prefab, but i got a popup telling me my object was not the same class type?

Mar 23 '11 at 10:57 PM GreenHat

Did you drop it on the prefab (in the Project window) or an instance of the prefab (in the Hierarchy window)?

Mar 23 '11 at 11:31 PM DaveA

I tried dropping it in the Project prefab. I don't have an instance in the Hierarchy window...they're on the terrain layer.

Mar 24 '11 at 02:32 AM GreenHat
(comments are locked)
10|3000 characters needed characters left

Just out of curiosity, why not add your tree billboards as billboarded terrain grass? Would achieve the same effect. And for that matter, they would even be able to sway in the wind.

more ▼

answered Mar 23 '11 at 10:29 PM

Jason B gravatar image

Jason B
1.7k 29 32 44

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

hahaha no I did not try the Billboarding script from the script wiki! Now that I know that exists, I may juuust do that! Do you have a link?

The reason I didn't make it terrain grass is because my initial thought was: This tree type would only be painted far away from the player. I also have grasses as detailed grass. If I did the tree like this and it's only for distant trees, wouldn't I only see them as I just approached them like the grass layers? I know I can tweak the viewing distant of the grass details as a whole, but I don't want to have to 'draw' all that grass until i'm close...right?

more ▼

answered Mar 23 '11 at 10:46 PM

GreenHat gravatar image

GreenHat
3 6 6 7

Please add comments, rather than new answers, unless you really are answering your own question. Makes it easier to follow.

Mar 23 '11 at 11:32 PM DaveA

Ah, alright. That reasoning does actually make sense. Your script should work, but I think you'd have to hand-place each far-off tree. As far as I know, painted terrain objects can't run scripts (someone correct me if I'm wrong).

Mar 23 '11 at 11:36 PM Jason B

Damn...so no real way to make my terrain plane trees billboard?

Mar 24 '11 at 02:30 AM GreenHat

There's gotta be some kinda of work around...right?

Mar 24 '11 at 06:10 PM GreenHat
(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:

x1467
x248
x62

asked: Mar 23 '11 at 09:56 PM

Seen: 1749 times

Last Updated: Mar 23 '11 at 09:56 PM