Rotation around global axis

Users who are viewing this thread

Yoshiboy

Count
Hi,

Has anyone found a way to rotate a position around the global axis?

I have a set of angles to the global axis and I want to rotate a position such that it matches this. But obviously I can't do it this way without global rotations because a local rotation messes up any following rotations.

I can think of one solution, but it is nasty and involves incrementing a rotation a degree at a time to get it to line up. There must be something simpler.

If it really comes down to it I am tempted to try and add in some vector and matrix maths operations using slots and stuff -- but lets not go there for now.

Alternately can someone think of a way of storing the orientation of a scene prop instance in the module system so that it can then be rotated to that position later on.

Thanks,

Yoshiboy
 
I think it's the same with this :
SonKidd said:
4989378.bmp


Is it possible to do it without using trigonometry?

dunde said:
Code:
(position_transform_position_to_local, pos3, pos1, pos2),
(position_rotate_z, pos1, ":angle"),
(position_transform_position_to_parent, pos4, pos1, pos3),

pos4 is the final position

With reset the pos1 to (0,0,0) first and then putting the origin to pos2 (if you want the rotation point is on the current position but with global axis orientation), it will solve your problem.
 
If you want to do consecutive rotations, you must do the transformations for each rotation.

Example  : rotating pos1, a degree at z global azis, then  b degree at y global axis then c degree at z global azis again.

Code:
(init_position,pos2),                  # pos 2 has the same origin with pos 1, 
(position_copy_origin,pos2,pos1),      # with axis paralel to global
(position_transform_position_to_local, pos3, pos2, pos1),
(position_rotate_z, pos2, ":a_degree"),
(position_transform_position_to_parent, pos1, pos2, pos3),

(init_position,pos2),                  # pos 2 has the same origin with pos 1, 
(position_copy_origin,pos2,pos1),      # with axis paralel to global
(position_transform_position_to_local, pos3, pos2, pos1),
(position_rotate_y, pos2, ":b_degree"),
(position_transform_position_to_parent, pos1, pos2, pos3),

(init_position,pos2),                  # pos 2 has the same origin with pos 1, 
(position_copy_origin,pos2,pos1),      # with axis paralel to global
(position_transform_position_to_local, pos3, pos2, pos1),
(position_rotate_z, pos2, ":c_degree"),
(position_transform_position_to_parent, pos1, pos2, pos3),
 
Ah sorry I think there were some other bugs in my code causing trouble. I've still not solved what I want to but I'm definitely one step closer now.
 
Back
Top Bottom