めも

主にUnity

VRMのランタイムインポート後に武器をもたせる方法

string path;
var context = new VRMImporterContext();
var file = File.ReadAllBytes(path);
context.ParseGlb(file);
context.Load();
context.ShowMeshes();
context.EnableUpdateWhenOffscreen();
context.ShowMeshes();
model = context.Root;
Animator anim = null;
  if (model.GetComponent<Animator>() == null) {
  anim = model.AddComponent<Animator>();
}
else {
  anim = model.GetComponent<Animator>();
  anim.avatar = context.HumanoidAvatar;
 }
transform rightHand = anim.GetBoneTransform(HumanBodyBones.RightHand);
//あとはがんばる