f self._biped_setup_prim is None: add_reference_to_stage(self._biped_usd_path, self._biped_setup_prim_path) biped_xform = XFormPrim(self._biped_setup_prim_path) biped_xform.set_world_pose( position=[0, 0, 0], orientation=[0.70711, 0.70711, 0, 0] ) self._biped_setup_prim = self._stage.GetPrimAtPath( self._biped_setup_prim_path ) self._biped_setup_prim.GetAttribute("visibility").Set("invisible") # Load the character USD add_reference_to_stage( self._character_path_dict[character_name], f"/World/Character_{self._character_count}", ) # Set the character's transform character_prim = self._stage.GetPrimAtPath( f"/World/Character_{self._character_count}" ) xform = XFormPrim(f"/World/Character_{self._character_count}") xform.set_world_pose(position=position, orientation=orientation) # Add animation graph entry for the character # These need to be attached to the sub prim of the character # below 'ManRoot' and is of the type 'SkelRoot' skel_root_prim = None for child_prim in Usd.PrimRange(character_prim): print(child_prim.GetTypeName()) if child_prim.IsA(UsdSkel.Root): skel_root_prim = child_prim break if skel_root_prim is None: carb.log_error(f"Could not find 'SkelRoot' for character {character_name}. Not proceeding.") return None omni.kit.commands.execute('ApplyAnimationGraphAPICommand', paths=[Sdf.Path(skel_root_prim.GetPath())], animation_graph_path=Sdf.Path(self._biped_setup_prim_path + "/CharacterAnimation/AnimationGraph")) # Add behaviour script entry for the character omni.kit.commands.execute('ApplyScriptingAPICommand', paths=[Sdf.Path(skel_root_prim.GetPath())]) omni.kit.commands.execute('RefreshScriptingPropertyWindowCommand') attr = skel_root_prim.GetAttribute("omni:scripting:scripts") attr.Set([self.script_path])