Hi all,

PLEASE HELP!

I'm getting desperate. I cant match the orientation of a bone and a gizmo and rotate them together...

Here's my gizmo function.
myBias is an angle difference between the actual (world) bone orientation and the local bone orientation (0,0,0 at start)
The actual (world) bone orientation comes from a vec_set/sub/to_angle between the bone joint and its child joint (for example shoulder>elbow and elbow>wrist)
When I run the script and point to the elbow, the gizmo and bone rotate in sync, but when I rotate even a little the shoulder joint, the elbow bone will shift its rotation axis off from the elbow gizmo even with the aligning I'm doing for the gizmo towards new bone angles when I'm not pointing the mouse at the elbow gizmo.
(Testing with X axis gizmos only, for now...)
In other words, the elbow gizmo still has the same orientation it should towards the wrist joint, but the elbow joint behaves as being shifted from its original orientation relative to the bone when I point the mouse at the elbow gizmo after the shoulder has been rotated a little...
Code:
function rotationGizmo() {
	var myBias[3];

	ANGLE* tmpAng1[3];
	var tmpAng2[3];
	// WAIT FOR EXTERIOR INITIALIZATION
	wait(4);	
	vec_set( myBias[0] , my.pan );

	while(1) {
		if(my.bone_handle) {
			you = ptr_for_handle( my.parent_entity );	// Entity containing the bone
			if(you) {
		if(mouse_ent != me) {

				// Update my position to joint position
				vec_for_bone( my.x , you , (long)my.bone_handle );
				// Rotate gizmo to match bone orientation
				ang_for_bone( tmpAng2[0] , you , (long)my.bone_handle );
				vec_set( my.pan , myBias[0] );
				ang_add( my.pan , tmpAng2[0] );
		}

		if(mouse_ent == me) {
				ang_rotate( my.pan , vector( 5 * time_step , 0 , 0 ) );

				// Rotate bone to my Orientation
				ent_bonereset( you , (long)my.bone_handle );
				ang_diff( tmpAng1.pan , my.pan , myBias[0] );
				ent_bonerotate( you , (long)my.bone_handle , tmpAng1.pan );
		}

			}
		}
		wait(1);
	}
}



Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201