Advanced axis applying

A bit advanced task I can’t resolve:

I have a specific object
I have a vertex parent for the object
I want to set object’s local Z rotation to the vertex-parent’s global Z rotation, but not touch any other object’s rotation axis(so it doesn’t rotate around). How to do it?

More info:
Currently the object follows it’s vertex parent, but doesn’t rotate.
In future it should do the same, except it should spin around it’s Z axis so it fits the vertex-parent. It should rotate around local Z axis because it shouldn’t change it’s position relative to the vertex-parent!

So I am not the only one who can’t figure out how to do this formula in blender?


cont = blablabla
own = cont.owner
parent = own.parent #hope this works on vertex parent

own.localOrientation.z = parent.localOrientation.z

I am asking on how to do this code so it works as localOrientation.z doesn’t exist!

own.alignAxisToVect(own.parent.worldOrientation.col[2],2,1)

It applies the object’s global Z to the parents axis. I need to apply object’s local Z! Any ideas?

object.worldOrientation.col[2] = objects z axis

I don’t understand what your trying to accomplish,

objects local orientation = rotation difference from parent rotation.

I am trying to make sure object’s local rotation is the same as perents local rotation in Z axis. The local rotation, the axis which change their direction in world space, but not in relation to object.

your trying to keep the futurism shape matching the camera area?

Well, sth like that! In other words:
-Take sun. Rotati it in X and Y axis. Than hit R and Z twice to rotate it locally. You can see shadow frustum spin and nothing else happen. Now, vertex parent sun to object and parent it to another and rotate the last one I mentioned. The object which holds vertex parented sun will rotate around and match it’s local axis to it’s parent. I hope oyu got what is this. But sun frustum won’t rotate. We need to locally rotate sun so it fits it’s parent rotation in local Z! I hope you understand: frustum shouldn’t move away, sun’s X and Y local rotation SHOULDN’t be modified at all, otherwise shadows will move like sun would be changing position.

just have logic rotate the z axis ?

The same logic that rotates your actor?

Um… It is mouselook! I’ma try out!

Add mouselook, so simple:D