How to use armature to align terrain props (trees, grass, etc)?

I am using the BI particle system to create terrain props and I have it set up so the props emit along the face normal. Can anyone think of a way to use armature to “bend” the props so that base remains aligned with the face, but the mid and upper sections curve towards the sky (or away from the ground). In this image the green plane is the ground, the white plane is a mountain side, and the three bones the base, mid, and upper sections. Any ideas on how to accomplish this? It doesn’t have to be with armatures, any method is fine.


add a empty, align the empty to the top bone,

have the empty do
import bge
from mathutils import Vector
cont = bge.logic.getCurrentController()
own=cont.owner

own.alignAxisToVect(Vector([0,0,0]),1,1)

then run the armature for 1 frame.
this will align the tree, but can you apply the animation
and then remove parent, and delete the armature and empty?

otherwise it sounds like alot of overhead.

Edit: just noted your game uses a round planet, your going to want to use
own.alignAxisToVect(own.worldPosition-PlanetCore.worldPosition),1,1)

so the trees all point away from the planet center.

I plan to align everything before run time, so I am not worried about the overhead.

When using the BI particle system, is there a way to make the child objects of the particle objects real when using “Make Duplicates Real” (Shift Ctrl A)?

Bpy :expressionless: idk

but since your using BPY anyway to generate the world, you can use it to align the armature :smiley:

(this is nice because you can apply the transforms and delete the armature)

Anyone have any thoughts on how to maintain parent relationships when making duplicates real?

So maintaining parent relationships is out of the question, however this script from CoDEmanX automates the process of assigning an armature modifier to all mesh objects while setting the object parameter to an armature object with the same numerical suffix. don’t ask me how it works, I just know it does.