Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve RuntimeUtil.IsAvatarRoot() #68

Open
kaikoga opened this issue Oct 23, 2023 · 0 comments · May be fixed by #71
Open

Improve RuntimeUtil.IsAvatarRoot() #68

kaikoga opened this issue Oct 23, 2023 · 0 comments · May be fixed by #71

Comments

@kaikoga
Copy link
Contributor

kaikoga commented Oct 23, 2023

public static bool IsAvatarRoot(Transform target)
{
#if NDMF_VRCSDK3_AVATARS
return target.GetComponent<VRCAvatarDescriptor>();
#else
var an = target.GetComponent<Animator>();
if (!an) return false;
var parent = target.transform.parent;
return !(parent && parent.GetComponentInParent<Animator>());
#endif
}

as-is

  • VRCSDK project: true for VRC avatars, false for non-VRC avatars
  • non-VRCSDK project: true for VRC and non-VRC avatars

to-be

  • VRCSDK projects should be able to handle non-VRC avatars, but not lenient enough to treat all Animators as avatars
  • Something like...?
    • If any avatar platform is detected (for example, VRCSDK and/or uniVRM), iterate through all platform specific checks
    • Else, fallback to Animator heuristic (current non-VRC implementation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant