[solved] Locked to camera !!

Hi all !

As some of you may know I’m working on Trees and grass at the mo’ And i wanted to make the grassalphaplane face the camera all the time (rotate around Z) plus i want some leaf’s on a tree to follow the camera (360*) If i have one plane (say for a leaf) and i give it all the properties (locked to camera/ animation and so on) can i copy it around, so i don’t have to apply the constraint to all the planes ?

to sum up::spin:
1: how do i fix a planes view to the camera in Z rotation only (but locked to it’s location)
2: How do i fix a plane to the camera so it follows 360* (but locked to it’s location)
3: can i copy one plane with all these properties (like if i make a group of leaf’s and copy them to the scene ?)

There’s a few ways to do this.

1- if you set a face to billboard (texFace settings, in edit mode) it should behave like this, as long as it remains oriented along the Z axis. I’m not sure this works in glsl mode, I haven’t tried it.
For a version in which you get better control, probably at the cost of some efficiency (I haven’t benchmarked) you could use python, get the vector from the object to the camera, and use alignAxisToVect() with which ever axis the face’s normal points along to, well, align the axis to the vector. After this, align the Z axis to the global Z (or any other angle you want) and it should work out.
The advantage of this method is you can rotate the object, so grass that grows sideways whould billboard correctly (I dunno if you have any desire to do this, it’s be more readily useful in something like a lightsaber blade to simulate volume in an object that rotates a lot)

2- in the same place as the billboard option is, you can instead set the face to halo. This means it will face the camera at all times, as long as the face was oriented correctly in the first place (I believe it’s along the +X? experiment to find out)

Keep in mind that halo, as well as billboarding, rotates around the object center, not the faces center. To have a munch of seperate planes with leaves set to halo, you need each set to be their own object. If you parent them to the tree and make them all one group, you can add the group as if it were a single object. This brings me to 3- if you append a group from your source blend and use dupligroups (or just use dupligroups, if your tree is already in the correct blend) for every vertex on the dupligrouped object another tree whould pop up. Quite handy, really. If you keep the tree in a separate blend and append it in, you can use it in multiple blends and any change made to the source will show up in all the appended versions.

I made this .blend file

I made a constraint between the monkey and the camera, if you rotate the camera, then the monkey does the same. but when i run the game “p” it does not work.

Select camera view, and run the game. You are a character with mouse look, and W,S,A,D movement

What am i doing wrong here ???:no:


constraint.blend (187 KB)

Constraints don’t all necessarily work in the game engine, also you’d want it to be a track to, rather than copy rotation. You can use an edit object actuator for a track to, or python, or set the face mode (probably the most efficient)

Arghhh i just cant get it to work !!!

What is this face mode method you talk about ?? cant find it in blender :spin: im loosing my mind here !!!

Here’s an example blend- I’ve included 3 methods for both halo and billboard- logic, face settings, and python.


billboard.blend (146 KB)

WOW !!!

I must say…you go out of your way to help out here !!!

I will start looking at your file ASAP !!!

You are the kind of people that makes this forum, and blender worth learning and supporting !!!:wink:

Got it working on my setup !!

The one that worked best in my setup was the Logic Halo…the others dit not show up in GE when textured for some reason !!

But now i got something to work with…thx a mill m8