/// <summary> /// ボーン変形 /// </summary> public void Process() { if (null != additive_parent) { //付与親有りなら LiteTransform additive_parent_transform = additive_parent.GetDeltaTransform(add_local); if (add_move) { //付与移動有りなら transform.localPosition += additive_parent_transform.position * additive_rate; } if (add_rotate) { //付与回転有りなら Quaternion delta_rotate_rate; if (0.0f <= additive_rate) { //正回転 delta_rotate_rate = Quaternion.Slerp(Quaternion.identity, additive_parent_transform.rotation, additive_rate); } else { //逆回転 Quaternion additive_parent_delta_rotate_reverse = Quaternion.Inverse(additive_parent_transform.rotation); delta_rotate_rate = Quaternion.Slerp(Quaternion.identity, additive_parent_delta_rotate_reverse, -additive_rate); } transform.localRotation *= delta_rotate_rate; } } }
public void Process() { if (null != additive_parent) { LiteTransform deltaTransform = additive_parent.GetDeltaTransform(add_local); if (add_move) { Transform transform = this.transform; transform.localPosition = transform.localPosition + deltaTransform.position * additive_rate; } if (add_rotate) { Quaternion val; if (0f <= additive_rate) { val = Quaternion.Slerp(Quaternion.identity, deltaTransform.rotation, additive_rate); } else { Quaternion val2 = Quaternion.Inverse(deltaTransform.rotation); val = Quaternion.Slerp(Quaternion.identity, val2, 0f - additive_rate); } Transform transform2 = this.transform; transform2.localRotation = transform2.localRotation * val; } } }