Esempio n. 1
0
        public void SetWorldPose_SetsWorldPositionRotationLength_ChainReversedCreationOrder()
        {
            CreateChainReversedCreationOrder();

            var worldPose = new BonePose[3]
            {
                BonePose.Create(Pose.Create(Vector3.zero, Quaternion.AngleAxis(30, Vector3.forward)), 0f),
                BonePose.Create(Pose.Create(Vector3.zero, Quaternion.AngleAxis(30, Vector3.forward)), 0f),
                BonePose.Create(Pose.Create(Vector3.zero, Quaternion.AngleAxis(30, Vector3.forward)), 0f),
            };

            m_Skeleton.SetWorldPose(worldPose);

            Assert.AreEqual(worldPose[0].pose.position, m_Skeleton.GetBone(0).position, "Incorrect position");
            Assert.AreEqual(worldPose[1].pose.position, m_Skeleton.GetBone(1).position, "Incorrect position");
            Assert.AreEqual(worldPose[2].pose.position, m_Skeleton.GetBone(2).position, "Incorrect position");

            Assert.That(m_Skeleton.GetBone(0).rotation, Is.EqualTo(worldPose[0].pose.rotation).Using(quatCompare), "Incorrect rotation");
            Assert.That(m_Skeleton.GetBone(1).rotation, Is.EqualTo(worldPose[1].pose.rotation).Using(quatCompare), "Incorrect rotation");
            Assert.That(m_Skeleton.GetBone(2).rotation, Is.EqualTo(worldPose[2].pose.rotation).Using(quatCompare), "Incorrect rotation");

            Assert.AreEqual(worldPose[0], m_Skeleton.GetBone(0).worldPose, "Incorrect pose");
            Assert.AreEqual(worldPose[1], m_Skeleton.GetBone(1).worldPose, "Incorrect pose");
            Assert.AreEqual(worldPose[2], m_Skeleton.GetBone(2).worldPose, "Incorrect pose");
        }
Esempio n. 2
0
        public void SetLocalPose_SetsLocalPositionRotationLength()
        {
            CreateChain();

            var localPose = new BonePose[3]
            {
                BonePose.Create(Pose.Create(Vector3.zero, Quaternion.AngleAxis(30, Vector3.forward)), 0f),
                BonePose.Create(Pose.Create(Vector3.zero, Quaternion.AngleAxis(30, Vector3.forward)), 0f),
                BonePose.Create(Pose.Create(Vector3.zero, Quaternion.AngleAxis(30, Vector3.forward)), 0f),
            };

            m_Skeleton.SetLocalPose(localPose);

            Assert.AreEqual(localPose[0].pose.position, m_Skeleton.GetBone(0).localPosition, "Incorrect position");
            Assert.AreEqual(localPose[1].pose.position, m_Skeleton.GetBone(1).localPosition, "Incorrect position");
            Assert.AreEqual(localPose[2].pose.position, m_Skeleton.GetBone(2).localPosition, "Incorrect position");

            Assert.That(m_Skeleton.GetBone(0).localRotation, Is.EqualTo(localPose[0].pose.rotation).Using(quatCompare), "Incorrect rotation");
            Assert.That(m_Skeleton.GetBone(1).localRotation, Is.EqualTo(localPose[1].pose.rotation).Using(quatCompare), "Incorrect rotation");
            Assert.That(m_Skeleton.GetBone(2).localRotation, Is.EqualTo(localPose[2].pose.rotation).Using(quatCompare), "Incorrect rotation");

            Assert.AreEqual(localPose[0], m_Skeleton.GetBone(0).localPose, "Incorrect pose");
            Assert.AreEqual(localPose[1], m_Skeleton.GetBone(1).localPose, "Incorrect pose");
            Assert.AreEqual(localPose[2], m_Skeleton.GetBone(2).localPose, "Incorrect pose");
        }