public void CannotCreateRigSkeletonWithMoreThanOneRoot() { var animationChannel = new IAnimationChannel[] { new LocalTranslationChannel { Id = "Root" }, new LocalRotationChannel { Id = "Root" }, new LocalScaleChannel { Id = "Root" }, }; var skeletonNodes = new SkeletonNode[] { new SkeletonNode { ParentIndex = -1 }, new SkeletonNode { ParentIndex = 0 }, new SkeletonNode { ParentIndex = -1 }, }; Assert.Throws <ArgumentException>(() => RigBuilder.CreateRigDefinition(skeletonNodes, null, animationChannel)); }
public void CanInstantiatePrefabEntity() { var instanceCount = 100; var skeletonNodes = new SkeletonNode[] { new SkeletonNode { ParentIndex = -1, Id = "Root", AxisIndex = -1 }, new SkeletonNode { ParentIndex = 0, Id = "Hips", AxisIndex = -1 }, new SkeletonNode { ParentIndex = 1, Id = "LeftUpLeg", AxisIndex = -1 }, new SkeletonNode { ParentIndex = 1, Id = "RightUpLeg", AxisIndex = -1 } }; var rigDefinition = RigBuilder.CreateRigDefinition(skeletonNodes); var prefab = RigEntityBuilder.CreatePrefabEntity(m_Manager, rigDefinition); var entities = new NativeArray <Entity>(instanceCount, Allocator.Temp); m_Manager.Instantiate(prefab, entities); foreach (var entity in entities) { CheckEntityHasRigComponentTypeAndBufferResized(entity, rigDefinition, RigEntityBuilder.RigComponentTypes, skeletonNodes.Length); } }
public void CanSetDestinationRigDefinition() { var channels = new IAnimationChannel[] { new LocalTranslationChannel { Id = "Root", DefaultValue = float3.zero }, new LocalTranslationChannel { Id = "Child1", DefaultValue = float3.zero }, new LocalTranslationChannel { Id = "Child2", DefaultValue = float3.zero }, }; var rig = new Rig { Value = RigBuilder.CreateRigDefinition(channels) }; var rigRemapper = CreateNode <RigRemapperNode>(); Set.SendMessage(rigRemapper, RigRemapperNode.SimulationPorts.DestinationRig, rig); var otherRig = Set.GetDefinition(rigRemapper).ExposeKernelData(rigRemapper).DestinationRigDefinition; Assert.That(otherRig.Value.GetHashCode(), Is.EqualTo(rig.Value.Value.GetHashCode())); }
private static BlobAssetReference <RigDefinition> CreateTestRigDefinition() { var skeletonNodes = new[] { new SkeletonNode { ParentIndex = -1, Id = "Root", AxisIndex = -1 }, new SkeletonNode { ParentIndex = 0, Id = "Child1", AxisIndex = -1 }, new SkeletonNode { ParentIndex = 1, Id = "Child2", AxisIndex = -1 }, new SkeletonNode { ParentIndex = 2, Id = "Child3", AxisIndex = -1 }, new SkeletonNode { ParentIndex = 3, Id = "Child4", AxisIndex = -1 }, }; var channels = new IAnimationChannel[] { new FloatChannel { Id = "IKWeight", DefaultValue = 0.0f }, new IntChannel { Id = "Type", DefaultValue = 10 } }; return(RigBuilder.CreateRigDefinition(skeletonNodes, null, channels)); }
private static BlobAssetReference <RigDefinition> CreateTestRigDefinition() { var skeletonNodes = new[] { new SkeletonNode { ParentIndex = -1, Id = "Root", AxisIndex = -1, LocalTranslationDefaultValue = new float3(0, 0, 0), LocalRotationDefaultValue = new quaternion(0, 0, 0, 1), LocalScaleDefaultValue = new float3(1, 1, 1), }, new SkeletonNode { ParentIndex = 0, Id = "Child1", AxisIndex = -1, LocalTranslationDefaultValue = new float3(0, 0, 0), LocalRotationDefaultValue = new quaternion(0, 0, 0, 1), LocalScaleDefaultValue = new float3(1, 1, 1), }, new SkeletonNode { ParentIndex = 0, Id = "Child2", AxisIndex = -1, LocalTranslationDefaultValue = new float3(0, 0, 0), LocalRotationDefaultValue = new quaternion(0, 0, 0, 1), LocalScaleDefaultValue = new float3(1, 1, 1), } }; return(RigBuilder.CreateRigDefinition(skeletonNodes)); }
public void CannotCreateRigSkeletonWhenAxisIndexIsValidAndAxisIsNull() { var animationChannel = new IAnimationChannel[] { new LocalTranslationChannel { Id = "Root" }, new LocalRotationChannel { Id = "Root" }, new LocalScaleChannel { Id = "Root" }, }; var skeletonNodes = new SkeletonNode[] { new SkeletonNode { ParentIndex = -1, AxisIndex = 0 }, new SkeletonNode { ParentIndex = 0, AxisIndex = 1 }, new SkeletonNode { ParentIndex = 1, AxisIndex = 2 }, }; Assert.Throws <ArgumentNullException>(() => RigBuilder.CreateRigDefinition(skeletonNodes, null, animationChannel)); }
private static BlobAssetReference <RigDefinition> CreateTestRigDefinition() { var skeletonNodes = new[] { new SkeletonNode { ParentIndex = -1, Id = "Root", AxisIndex = -1 }, new SkeletonNode { ParentIndex = 0, Id = "Child1", AxisIndex = -1 }, }; var animationChannel = new IAnimationChannel[] { new FloatChannel { Id = "Root", DefaultValue = 1000.0f }, new FloatChannel { Id = "Child1", DefaultValue = 1000.0f }, new IntChannel { Id = "Root", DefaultValue = 1000 }, new IntChannel { Id = "Child1", DefaultValue = 1000 }, }; return(RigBuilder.CreateRigDefinition(skeletonNodes, null, animationChannel)); }
static BlobAssetReference <RigDefinition> CreateTestRigDefinition() { var skeletonNodes = new[] { new SkeletonNode { ParentIndex = -1, Id = "Root", AxisIndex = -1 }, new SkeletonNode { ParentIndex = 0, Id = "Child1", AxisIndex = -1 }, new SkeletonNode { ParentIndex = 0, Id = "Child2", AxisIndex = -1 } }; var customChannels = new IAnimationChannel[] { new FloatChannel { Id = "myFloat", DefaultValue = k_DefaultFloatValue }, new IntChannel { Id = "myInt", DefaultValue = k_DefaultIntValue } }; return(RigBuilder.CreateRigDefinition(skeletonNodes, null, customChannels)); }
private static BlobAssetReference <RigDefinition> CreateTestRigDefinition() { var skeletonNodes = new[] { new SkeletonNode { ParentIndex = -1, Id = "Root", AxisIndex = -1, LocalTranslationDefaultValue = new float3(100.0f, 0.0f, 0.0f), LocalRotationDefaultValue = quaternion.RotateX(math.radians(90.0f)), LocalScaleDefaultValue = new float3(10.0f, 1.0f, 1.0f) }, new SkeletonNode { ParentIndex = 0, Id = "Child1", AxisIndex = -1, LocalTranslationDefaultValue = new float3(0.0f, 100.0f, 0.0f), LocalRotationDefaultValue = quaternion.RotateY(math.radians(90.0f)), LocalScaleDefaultValue = new float3(1.0f, 1.0f, 10.0f) } }; var animationChannel = new IAnimationChannel[] { new FloatChannel { Id = "Root", DefaultValue = 10f }, new FloatChannel { Id = "Child1", DefaultValue = 10f }, new IntChannel { Id = "Root", DefaultValue = 20 }, new IntChannel { Id = "Child1", DefaultValue = 20 } }; return(RigBuilder.CreateRigDefinition(skeletonNodes, null, animationChannel)); }
// TODO (mogens) move this to RigConversion in animation package ? public static BlobAssetReference <RigDefinition> ConvertRig(RigComponent rigComponent) { var skeletonNodes = RigGenerator.ExtractSkeletonNodesFromRigComponent(rigComponent); var channels = RigGenerator.ExtractAnimationChannelFromRigComponent(rigComponent); var rigDefinition = RigBuilder.CreateRigDefinition(skeletonNodes, null, channels); return(rigDefinition); }
BlobAssetReference <RigDefinition> CreateTestRigDefinition() { var skeletonNodes = new[] { new SkeletonNode { ParentIndex = -1, Id = "Root", AxisIndex = -1 } }; return(RigBuilder.CreateRigDefinition(skeletonNodes)); }
protected override void OnUpdate() { Entities.ForEach((RigComponent rigComponent) => { var rigEntity = GetPrimaryEntity(rigComponent); var skeletonNodes = RigGenerator.ExtractSkeletonNodesFromRigComponent(rigComponent); var channels = RigGenerator.ExtractAnimationChannelFromRigComponent(rigComponent); var rigDefinition = RigBuilder.CreateRigDefinition(skeletonNodes, null, channels); RigEntityBuilder.SetupRigEntity(rigEntity, DstEntityManager, rigDefinition); }); }
public void OneTimeSetup() { var skeletonNodes = new[] { new SkeletonNode { ParentIndex = -1, Id = string.Empty, AxisIndex = -1 }, new SkeletonNode { ParentIndex = 0, Id = "Child1", AxisIndex = -1 }, new SkeletonNode { ParentIndex = 0, Id = "Child2", AxisIndex = -1 } }; RigDefinition = RigBuilder.CreateRigDefinition(skeletonNodes); var r = new Mathematics.Random(0x12345678); var range = new float3(100); var fullClip = new UnityEngine.AnimationClip(); // add some error into the clip, so it is not perfectly frame aligned float clipDuration = clipFrames / fullClip.frameRate + 0.123f / fullClip.frameRate; CreateLinearTranslate(fullClip, string.Empty, float3.zero, new float3(0, 1, 0), clipDuration); CreateLinearTranslate(fullClip, "Child1", r.NextFloat3(-range, range), r.NextFloat3(-range, range), clipDuration); CreateLinearTranslate(fullClip, "Child2", r.NextFloat3(-range, range), r.NextFloat3(-range, range), clipDuration); CreateRotation(fullClip, string.Empty, quaternion.identity, r.NextQuaternionRotation(), clipDuration); CreateRotation(fullClip, "Child1", r.NextQuaternionRotation(), r.NextQuaternionRotation(), clipDuration); CreateRotation(fullClip, "Child2", r.NextQuaternionRotation(), r.NextQuaternionRotation(), clipDuration); CreateScale(fullClip, string.Empty, new float3(1), new float3(1), clipDuration); CreateScale(fullClip, "Child1", new float3(1), new float3(2), clipDuration); CreateScale(fullClip, "Child2", new float3(2), new float3(3), clipDuration); FullAnimationClip = ClipBuilder.AnimationClipToDenseClip(fullClip); var partialClip = new UnityEngine.AnimationClip(); CreateLinearTranslate(partialClip, "Child1", r.NextFloat3(-range, range), r.NextFloat3(-range, range), clipDuration); CreateRotation(partialClip, string.Empty, quaternion.identity, r.NextQuaternionRotation(), clipDuration); CreateRotation(partialClip, "Child2", quaternion.identity, r.NextQuaternionRotation(), clipDuration); CreateScale(partialClip, string.Empty, float3.zero, new float3(1), clipDuration); PartialAnimationClip = ClipBuilder.AnimationClipToDenseClip(partialClip); var alignedClip = new UnityEngine.AnimationClip(); CreateLinearTranslate(alignedClip, string.Empty, float3.zero, new float3(0, 1, 0), 1.0f); CreateLinearTranslate(alignedClip, "Child1", r.NextFloat3(-range, range), r.NextFloat3(-range, range), 1.0f); CreateLinearTranslate(alignedClip, "Child2", r.NextFloat3(-range, range), r.NextFloat3(-range, range), 1.0f); CreateRotation(alignedClip, string.Empty, quaternion.identity, r.NextQuaternionRotation(), 1.0f); AlignedClip = ClipBuilder.AnimationClipToDenseClip(alignedClip); }
public void CanCreatePrefabEntity() { var skeletonNodes = new SkeletonNode[] { new SkeletonNode { ParentIndex = -1, Id = "Root", AxisIndex = -1 } }; var rigDefinition = RigBuilder.CreateRigDefinition(skeletonNodes); var prefab = RigEntityBuilder.CreatePrefabEntity(m_Manager, rigDefinition); CheckEntityHasRigComponentTypeAndBufferResized(prefab, rigDefinition, RigEntityBuilder.RigPrefabComponentTypes, skeletonNodes.Length); }
public void CanCreateRigWithoutAnimationChannel() { var skeletonNodes = new SkeletonNode[] { new SkeletonNode { ParentIndex = -1, Id = "Root", AxisIndex = -1 } }; var rig = RigBuilder.CreateRigDefinition(skeletonNodes); Assert.That(rig.Value.Skeleton.BoneCount, Is.EqualTo(1)); Assert.That(rig.Value.Bindings.TranslationBindings.Length, Is.EqualTo(1)); Assert.That(rig.Value.Bindings.RotationBindings.Length, Is.EqualTo(1)); Assert.That(rig.Value.Bindings.ScaleBindings.Length, Is.EqualTo(1)); }
public void CannotCreateRigSkeletonWhenAxisIndexIsInvalid() { var animationChannel = new IAnimationChannel[] { new LocalTranslationChannel { Id = "Root" }, new LocalRotationChannel { Id = "Root" }, new LocalScaleChannel { Id = "Root" }, }; var skeletonNodes = new SkeletonNode[] { new SkeletonNode { ParentIndex = -1, AxisIndex = 0 }, new SkeletonNode { ParentIndex = 0, AxisIndex = 1 }, new SkeletonNode { ParentIndex = 1, AxisIndex = 100 }, }; var axis = new Axis[] { new Axis(), new Axis() }; Assert.Throws <ArgumentOutOfRangeException>(() => RigBuilder.CreateRigDefinition(skeletonNodes, axis, animationChannel)); skeletonNodes = new SkeletonNode[] { new SkeletonNode { ParentIndex = -1, AxisIndex = 0 }, new SkeletonNode { ParentIndex = 0, AxisIndex = 1 }, new SkeletonNode { ParentIndex = 1, AxisIndex = -100 }, }; Assert.Throws <ArgumentOutOfRangeException>(() => RigBuilder.CreateRigDefinition(skeletonNodes, axis, animationChannel)); }
private static BlobAssetReference <RigDefinition> CreateTestRigDefinition() { var skeletonNodes = new[] { new SkeletonNode { ParentIndex = -1, Id = "Root", AxisIndex = -1, LocalRotationDefaultValue = quaternion.identity, LocalScaleDefaultValue = new float3(1, 1, 1) }, new SkeletonNode { ParentIndex = 0, Id = "Between", AxisIndex = -1, LocalRotationDefaultValue = quaternion.identity, LocalScaleDefaultValue = new float3(1, 1, 1) }, new SkeletonNode { ParentIndex = 1, Id = "Motion", AxisIndex = -1, LocalRotationDefaultValue = quaternion.identity, LocalScaleDefaultValue = new float3(1, 1, 1) } }; return(RigBuilder.CreateRigDefinition(skeletonNodes)); }
public static void BuildRigDefinitionBlobAsset(string path) { var gameObject = AssetDatabase.LoadMainAssetAtPath(path) as GameObject; if (gameObject == null) { throw new NullReferenceException($"Asset '{path}' not found"); } var blobPath = GetBlobAssetPath(path); var skeletonNode = RigGenerator.ExtractSkeletonNodesFromGameObject(gameObject); var rigDefinition = RigBuilder.CreateRigDefinition(skeletonNode); BlobFile.WriteBlobAsset(ref rigDefinition, blobPath); }
public void RigDefinitionWithDifferentDataHaveDifferentHashCode() { var animationChannel = new IAnimationChannel[] { new LocalTranslationChannel { Id = "Root" }, new LocalTranslationChannel { Id = "Root" }, new LocalTranslationChannel { Id = "Root" }, new LocalRotationChannel { Id = "Root" }, new LocalScaleChannel { Id = "Root" }, new LocalRotationChannel { Id = "Root" }, new LocalTranslationChannel { Id = "Root" } }; var skeletonNodes1 = new SkeletonNode[] { new SkeletonNode { ParentIndex = -1, AxisIndex = -1, Id = "Root" } }; var rig1 = RigBuilder.CreateRigDefinition(skeletonNodes1, null, animationChannel); var skeletonNodes2 = new SkeletonNode[] { new SkeletonNode { ParentIndex = -1, AxisIndex = -1, Id = "Root1" } }; var rig2 = RigBuilder.CreateRigDefinition(skeletonNodes2, null, animationChannel); Assert.That(rig1.Value.GetHashCode(), Is.Not.EqualTo(rig2.Value.GetHashCode())); }
BlobAssetReference <RigDefinition> CreateTestRigDefinition() { var skeletonNodes = new[] { new SkeletonNode { ParentIndex = -1, Id = "Root", AxisIndex = -1, LocalTranslationDefaultValue = float3.zero, LocalRotationDefaultValue = quaternion.identity, LocalScaleDefaultValue = mathex.one() }, new SkeletonNode { ParentIndex = 0, Id = "UpperArm", AxisIndex = -1, LocalTranslationDefaultValue = new float3(1f, 0f, 0f), LocalRotationDefaultValue = quaternion.identity, LocalScaleDefaultValue = mathex.one() }, new SkeletonNode { ParentIndex = 1, Id = "LowerArm", AxisIndex = -1, LocalTranslationDefaultValue = new float3(1f, 0f, 0f), LocalRotationDefaultValue = quaternion.identity, LocalScaleDefaultValue = mathex.one() }, new SkeletonNode { ParentIndex = 2, Id = "Hand", AxisIndex = -1, LocalTranslationDefaultValue = new float3(1f, 0.02f, 0f), LocalRotationDefaultValue = quaternion.identity, LocalScaleDefaultValue = mathex.one() }, }; return(RigBuilder.CreateRigDefinition(skeletonNodes)); }
public void CanRemoveDuplicateChannelFromRigDefinition() { var animationChannel = new IAnimationChannel[] { new LocalTranslationChannel { Id = "Root" }, new LocalTranslationChannel { Id = "Root" }, new LocalTranslationChannel { Id = "Root" }, new LocalRotationChannel { Id = "Root" }, new LocalScaleChannel { Id = "Root" }, new LocalRotationChannel { Id = "Root" }, new LocalTranslationChannel { Id = "Root" } }; var skeletonNodes = new SkeletonNode[] { new SkeletonNode { ParentIndex = -1, AxisIndex = -1, Id = "Root" } }; var rig = RigBuilder.CreateRigDefinition(skeletonNodes, null, animationChannel); Assert.That(rig.Value.Bindings.TranslationBindings.Length, Is.EqualTo(1)); Assert.That(rig.Value.Bindings.RotationBindings.Length, Is.EqualTo(1)); Assert.That(rig.Value.Bindings.ScaleBindings.Length, Is.EqualTo(1)); }
public void CanCreateRigWithoutSkeleton() { var animationChannel = new IAnimationChannel[] { new LocalTranslationChannel { Id = "Root" }, new LocalRotationChannel { Id = "Root" }, new LocalScaleChannel { Id = "Root" }, }; var rig = RigBuilder.CreateRigDefinition(animationChannel); Assert.That(rig.Value.Skeleton.BoneCount, Is.EqualTo(0)); Assert.That(rig.Value.Bindings.TranslationBindings.Length, Is.EqualTo(1)); Assert.That(rig.Value.Bindings.RotationBindings.Length, Is.EqualTo(1)); Assert.That(rig.Value.Bindings.ScaleBindings.Length, Is.EqualTo(1)); Assert.That(rig.Value.Bindings.FloatBindings.Length, Is.EqualTo(0)); Assert.That(rig.Value.Bindings.IntBindings.Length, Is.EqualTo(0)); }
protected void OneTimeSetUp() { var srcSkeletonNodes = new SkeletonNode[] { new SkeletonNode { Id = "Root", ParentIndex = -1, AxisIndex = -1 }, new SkeletonNode { Id = "Hips", ParentIndex = 0, AxisIndex = -1 }, new SkeletonNode { Id = "LeftUpLeg", ParentIndex = 1, AxisIndex = -1 }, new SkeletonNode { Id = "RightUpLeg", ParentIndex = 1, AxisIndex = -1 }, }; var srcChannels = new IAnimationChannel[] { new LocalTranslationChannel { Id = "Velocity" }, new LocalRotationChannel { Id = "AngularVelocity" }, new FloatChannel { Id = "Intensity" }, new FloatChannel { Id = "Radius" }, new IntChannel { Id = "Index" }, new IntChannel { Id = "Mode" }, }; var dstSkeletonNodes = new SkeletonNode[] { new SkeletonNode { Id = "AnotherRoot", ParentIndex = -1, AxisIndex = -1 }, new SkeletonNode { Id = "AnotherHips", ParentIndex = 0, AxisIndex = -1 }, new SkeletonNode { Id = "AnotherLeftUpLeg", ParentIndex = 1, AxisIndex = -1 }, new SkeletonNode { Id = "AnotherRightUpLeg", ParentIndex = 1, AxisIndex = -1 }, }; var dstChannels = new IAnimationChannel[] { new LocalTranslationChannel { Id = "AnotherVelocity" }, new LocalRotationChannel { Id = "AnotherAngularVelocity" }, new FloatChannel { Id = "AnotherIntensity" }, new FloatChannel { Id = "AnotherRadius" }, new IntChannel { Id = "AnotherIndex" }, new IntChannel { Id = "AnotherMode" }, }; m_SourceRig = RigBuilder.CreateRigDefinition(srcSkeletonNodes, null, srcChannels); m_DestinationRig = RigBuilder.CreateRigDefinition(dstSkeletonNodes, null, dstChannels); }
public void CanRemapAllIntChannel() { var sourceChannels = new IAnimationChannel[] { new IntChannel { Id = "Root", DefaultValue = m_ExpectedSourceInt }, new IntChannel { Id = "Child1", DefaultValue = m_ExpectedSourceInt }, new IntChannel { Id = "Child2", DefaultValue = m_ExpectedSourceInt }, }; var sourceRig = new Rig { Value = RigBuilder.CreateRigDefinition(sourceChannels) }; var destinationChannels = new IAnimationChannel[] { new IntChannel { Id = "AnotherRoot", DefaultValue = 0 }, new IntChannel { Id = "AnotherChild1", DefaultValue = 0 }, new IntChannel { Id = "AnotherChild2", DefaultValue = 0 }, }; var destinationRig = new Rig { Value = RigBuilder.CreateRigDefinition(destinationChannels) }; var rigEntity = m_Manager.CreateEntity(); RigEntityBuilder.SetupRigEntity(rigEntity, m_Manager, destinationRig); var rigRemapQuery = new RigRemapQuery { AllChannels = new [] { new ChannelMap { SourceId = "Root", DestinationId = "AnotherRoot" }, new ChannelMap { SourceId = "Child1", DestinationId = "AnotherChild1" }, new ChannelMap { SourceId = "Child2", DestinationId = "AnotherChild2" } } }; var remapTable = rigRemapQuery.ToRigRemapTable(sourceRig, destinationRig); // Here I'm using a layerMixer with no inputs connected // the expected result is to inject the default pose into Graph samples buffer var layerMixer = CreateNode <LayerMixerNode>(); Set.SendMessage(layerMixer, LayerMixerNode.SimulationPorts.Rig, sourceRig); var rigRemapper = CreateNode <RigRemapperNode>(); Set.Connect(layerMixer, LayerMixerNode.KernelPorts.Output, rigRemapper, RigRemapperNode.KernelPorts.Input); Set.SendMessage(rigRemapper, RigRemapperNode.SimulationPorts.SourceRig, sourceRig); Set.SendMessage(rigRemapper, RigRemapperNode.SimulationPorts.DestinationRig, destinationRig); Set.SendMessage(rigRemapper, RigRemapperNode.SimulationPorts.RemapTable, remapTable); var entityNode = CreateComponentNode(rigEntity); Set.Connect(rigRemapper, RigRemapperNode.KernelPorts.Output, entityNode); m_Manager.AddComponent <PreAnimationGraphTag>(rigEntity); m_AnimationGraphSystem.Update(); var streamECS = AnimationStream.CreateReadOnly( destinationRig, m_Manager.GetBuffer <AnimatedData>(rigEntity).AsNativeArray() ); Assert.That(streamECS.GetInt(0), Is.EqualTo(m_ExpectedSourceInt), "Channel int 0 doesn't match source rig default value"); Assert.That(streamECS.GetInt(1), Is.EqualTo(m_ExpectedSourceInt), "Channel int 1 doesn't match source rig default value"); Assert.That(streamECS.GetInt(2), Is.EqualTo(m_ExpectedSourceInt), "Channel int 2 doesn't match source rig default value"); }
public void CanRemapRigRotationOffset() { var sourceChannels = new IAnimationChannel[] { new LocalRotationChannel { Id = "Root", DefaultValue = m_ExpectedSourceRotation }, new LocalRotationChannel { Id = "Child", DefaultValue = m_ExpectedSourceRotation }, }; var sourceRig = new Rig { Value = RigBuilder.CreateRigDefinition(sourceChannels) }; var destinationChannels = new IAnimationChannel[] { new LocalRotationChannel { Id = "AnotherRoot", DefaultValue = quaternion.identity }, new LocalRotationChannel { Id = "AnotherChild", DefaultValue = quaternion.identity }, }; var destinationRig = new Rig { Value = RigBuilder.CreateRigDefinition(destinationChannels) }; var rigEntity = m_Manager.CreateEntity(); RigEntityBuilder.SetupRigEntity(rigEntity, m_Manager, destinationRig); var rigRemapQuery = new RigRemapQuery { RotationChannels = new [] { new ChannelMap { SourceId = "Root", DestinationId = "AnotherRoot" }, new ChannelMap { SourceId = "Child", DestinationId = "AnotherChild", OffsetIndex = 1 } }, RotationOffsets = new [] { new RigRotationOffset(), new RigRotationOffset { PreRotation = math.normalize(math.quaternion(1, 2, 3, 4)), PostRotation = math.normalize(math.quaternion(5, 6, 7, 8)) } } }; var remapTable = rigRemapQuery.ToRigRemapTable(sourceRig, destinationRig); // Here I'm using a layerMixer with no inputs connected // the expected result is to inject the default pose into Graph samples buffer var layerMixer = CreateNode <LayerMixerNode>(); Set.SendMessage(layerMixer, LayerMixerNode.SimulationPorts.Rig, sourceRig); var rigRemapper = CreateNode <RigRemapperNode>(); Set.Connect(layerMixer, LayerMixerNode.KernelPorts.Output, rigRemapper, RigRemapperNode.KernelPorts.Input); Set.SendMessage(rigRemapper, RigRemapperNode.SimulationPorts.SourceRig, sourceRig); Set.SendMessage(rigRemapper, RigRemapperNode.SimulationPorts.DestinationRig, destinationRig); Set.SendMessage(rigRemapper, RigRemapperNode.SimulationPorts.RemapTable, remapTable); var entityNode = CreateComponentNode(rigEntity); Set.Connect(rigRemapper, RigRemapperNode.KernelPorts.Output, entityNode); m_Manager.AddComponent <PreAnimationGraphTag>(rigEntity); m_AnimationGraphSystem.Update(); var streamECS = AnimationStream.CreateReadOnly( destinationRig, m_Manager.GetBuffer <AnimatedData>(rigEntity).AsNativeArray() ); Assert.That(streamECS.GetLocalToParentRotation(1), Is.EqualTo(math.mul(rigRemapQuery.RotationOffsets[1].PreRotation, math.mul(m_ExpectedSourceRotation, rigRemapQuery.RotationOffsets[1].PostRotation))).Using(RotationComparer), "Channel localRotation doesn't match destination rig default value with rig rotation offset"); }