1
1
extern crate cgt_math;
2
- use cgt_math:: { Plane , Quaternion , Vector3 , Axis } ;
2
+ use cgt_math:: { Plane , Quaternion , Vector3 } ;
3
3
4
4
/// Calculates limb fk chain, hip, shoulder and face rotation.
5
5
/// May uses hip center as pivot.
@@ -57,9 +57,9 @@ fn torso_rotation(data: &[Vector3; 36], rotation_data: &mut [Quaternion; 36]) {
57
57
fn shoulder_rotation ( data : & [ Vector3 ; 36 ] , rotation_data : & mut [ Quaternion ; 36 ] ) {
58
58
// As the torso rotation usually is used to rotate the rig,
59
59
// the torso rotation got to be substracted from the hip rotation
60
- let shoulder_rot = Quaternion :: rotate_towards ( ( data[ 12 ] -data[ 34 ] ) . normalize ( ) , Axis :: Z , Axis :: Y ) ;
60
+ let shoulder_rot = Quaternion :: rotate_towards ( ( data[ 12 ] -data[ 34 ] ) . normalize ( ) , Vector3 :: Z , Vector3 :: Y ) ;
61
61
// Quaternion::from_vec_to_track_quat((data[12] - data[34]).normalize().neg(), 2, 1); // rotation from center to right shoulder
62
- let hip_rot = Quaternion :: rotate_towards ( ( data[ 24 ] - data[ 33 ] ) . normalize ( ) , Axis :: Z , Axis :: Y ) ; // rotation from center to right hip
62
+ let hip_rot = Quaternion :: rotate_towards ( ( data[ 24 ] - data[ 33 ] ) . normalize ( ) , Vector3 :: Z , Vector3 :: Y ) ; // rotation from center to right hip
63
63
// let hip_rot = Quaternion::from_vec_to_track_quat((data[24] - data[33]).normalize().neg(), 2, 1); // rotation from center to right hip
64
64
rotation_data[ 34 ] = shoulder_rot - hip_rot;
65
65
}
@@ -69,7 +69,7 @@ fn calc_limb_chain_rotations(data: &[Vector3; 4]) -> [Quaternion; 3] {
69
69
let mut arr: [ Quaternion ; 3 ] = [ Quaternion :: IDENTITY ; 3 ] ;
70
70
for i in 1 ..4 {
71
71
arr[ i - 1 ] =
72
- Quaternion :: rotate_towards ( ( data[ i-1 ] -data[ i] ) . normalize ( ) . neg ( ) , Axis :: X , Axis :: Z ) ;
72
+ Quaternion :: rotate_towards ( ( data[ i-1 ] -data[ i] ) . normalize ( ) . neg ( ) , Vector3 :: X , Vector3 :: Z ) ;
73
73
// Quaternion::from_vec_to_track_quat((data[i - 1] - data[i]).normalize().neg(), 4, 2);
74
74
}
75
75
return arr;
0 commit comments