void ApplyHumanPose(GameObject avatar, PumkinsPosePreset hp) { Undo.RegisterFullObjectHierarchyUndo(avatar, "Load Human Pose"); Vector3 pos = avatar.transform.position; Quaternion rot = avatar.transform.rotation; avatar.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity); hp.ApplyPreset(avatar); PumkinsAvatarTools.OnPoseWasChanged(PumkinsAvatarTools.PoseChangeType.Normal); avatar.transform.SetPositionAndRotation(pos, rot); }
public static void SetDefaultPoseByName(GameObject avatar, string poseName) { PumkinsPosePreset pose = DefaultPoses.Find(o => o.name.ToLower() == poseName.ToLower()); if (poseName.ToLower() == "tpose") { PumkinsAvatarTools.OnPoseWasChanged(PumkinsAvatarTools.PoseChangeType.Reset); } else { PumkinsAvatarTools.OnPoseWasChanged(PumkinsAvatarTools.PoseChangeType.Normal); } pose.ApplyPreset(avatar); }