First nullpointer bug when no head bone is present in certain cases
This commit is contained in:
parent
77d28adc6d
commit
6f1517a34b
@ -1130,7 +1130,12 @@ namespace Passer.Humanoid {
|
|||||||
// With ChangeAvatar, the bone may be at a different height than wat setup in the scene
|
// With ChangeAvatar, the bone may be at a different height than wat setup in the scene
|
||||||
// Therfore we need to use the target here
|
// Therfore we need to use the target here
|
||||||
// I don't understand myself here. Using bone again
|
// I don't understand myself here. Using bone again
|
||||||
Vector3 worldHeadEyeDelta = eyePosition - head.bone.transform.position;
|
Vector3 worldHeadEyeDelta;
|
||||||
|
if (neck.bone.transform != null)
|
||||||
|
worldHeadEyeDelta = eyePosition - head.bone.transform.position;
|
||||||
|
else
|
||||||
|
worldHeadEyeDelta = eyePosition - head.target.transform.position;
|
||||||
|
|
||||||
Vector3 localHeadEyeDelta = Quaternion.AngleAxis(-head.target.transform.eulerAngles.y, Vector3.up) * worldHeadEyeDelta;
|
Vector3 localHeadEyeDelta = Quaternion.AngleAxis(-head.target.transform.eulerAngles.y, Vector3.up) * worldHeadEyeDelta;
|
||||||
return localHeadEyeDelta;
|
return localHeadEyeDelta;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user