Hello. Let me explain the issue I’m facing. I’ve imported a SWAT character from Mixamo with a bunch of animations, it has an Animator component with the controller and an avatar assigned to it. I’ve also added a weapon (AKM) as a child of my character.
I’ve added a Rig Builder component to my character:
Then, I’ve created a RigLayer Game Object and assigned a Rig component to it which is assigned to the Rig Builder:
As a child of a RigLayer, I’ve added an object RightHandIK with a Two Bone IK Constraint component. I’ve added my characters Right Arm, Forearm and Hand for Root, Mid and Tip. As a target, I’ve temporarily added my AKM weapon’s Transform - just to see how it roughly works:
When I hit Play - my animations stopped working, character stays in the T-Pose and there are a bunch of errors in the Console:
I’ve copied 3 main types of error messages, here they are:
Transform 'WPN_AKM' not found in HumanDescription.
Could not resolve 'WPN_AKM/WPN_AKM' because the avatar is invalid. Please assign a valid Avatar or create one with AvatarBuilder.
InvalidOperationException: The TransformStreamHandle cannot be resolved.
UnityEngine.Animations.TransformStreamHandle.CheckIsValidAndResolve (UnityEngine.Animations.AnimationStream& stream) (at <947776085c2a45bebc6afa3092a3f6ed>:0)
UnityEngine.Animations.TransformStreamHandle.SetLocalTRS (UnityEngine.Animations.AnimationStream stream, UnityEngine.Vector3 position, UnityEngine.Quaternion rotation, UnityEngine.Vector3 scale, System.Boolean useMask) (at <947776085c2a45bebc6afa3092a3f6ed>:0)
UnityEngine.Animations.Rigging.RigSyncSceneToStreamJob+TransformSyncer.Sync (UnityEngine.Animations.AnimationStream& stream) (at Library/PackageCache/com.unity.animation.rigging@0.3.4-preview/Runtime/AnimationJobs/RigSyncSceneToStreamJob.cs:49)
UnityEngine.Animations.Rigging.RigSyncSceneToStreamJob.ProcessAnimation (UnityEngine.Animations.AnimationStream stream) (at Library/PackageCache/com.unity.animation.rigging@0.3.4-preview/Runtime/AnimationJobs/RigSyncSceneToStreamJob.cs:117)
UnityEngine.Animations.ProcessAnimationJobStruct`1[T].Execute (T& data, System.IntPtr animationStreamPtr, System.IntPtr methodIndex, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at <947776085c2a45bebc6afa3092a3f6ed>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
When I separate the weapon from the character hierarchy - there are no errors and all animations and IK working, the weapon just floats in the air and character’s right hand sticks to it.
What I’ve also noticed is, when instead of a weapon, I’ve added a simple 3D object as a child of the character, there are no errors when I press Play. But when I add some children to that 3D object - I get the same error as shown above. So for some reason, it doesn’t like when there’s a complex object is a child of a character, so it’s not that particular weapon that causes the issue.
So, my question is, how do I properly add weapon to my character using Animation rigging? Any advice or hints would be appreciated!