示例#1
0
        public MotionMatchingState(string name, MotionMatchingStateType type, int index, int stateID)
        {
            this.name               = name;
            this.stateType          = type;
            this.index              = index;
            this.nodeID             = stateID;
            poseCostType            = PoseCostType.Position;
            trajectoryCostType      = TrajectoryCostType.PositionVelocityOrientation;
            trajectoryCostWeight    = 1f;
            poseCostWeight          = 1f;
            transitions             = new List <Transition>();
            speedMultiplier         = 1f;
            whereCanFindingNextPose = new List <float2>();
            motionDataGroups        = new List <MotionDataGroup>();
            motionDataGroups.Add(new MotionDataGroup("MotionGroup"));

            switch (this.stateType)
            {
            case MotionMatchingStateType.MotionMatching:
                mmFeatures = new MotionMatchingStateFeatures();
                break;

            case MotionMatchingStateType.SingleAnimation:
                saFeatures = new SingleAnimationStateFeatures();
                break;

            case MotionMatchingStateType.ContactAnimationState:
                csFeatures = new ContactStateFeatures();
                break;
            }
        }
示例#2
0
 public void SetChangingOptions(
     PoseCostType poseCostType,
     TrajectoryCostType trajectoryCostType,
     ContactPointCostType contactCostType,
     ContactStateMovemetType movementType,
     NativeArray <BoneData> currentPose,
     NativeArray <TrajectoryPoint> currentTrajectory,
     NativeArray <FrameContact> currentContacts,
     NativeArray <float2> whereWeCanFindingPos,
     float trajectoryWeight,
     float poseWeight,
     float contactWeight
     )
 {
     this.poseCostType         = poseCostType;
     this.trajectoryCostType   = trajectoryCostType;
     this.contactCostType      = contactCostType;
     this.cntactMovmentType    = movementType;
     this.currentPose          = currentPose;
     this.currentTrajectory    = currentTrajectory;
     this.currentContactPoints = currentContacts;
     this.whereWeCanFindingPos = whereWeCanFindingPos;
     this.trajectoryWeight     = trajectoryWeight;
     this.poseWeight           = poseWeight;
     this.contactWeight        = contactWeight;
 }
示例#3
0
        public void SetChangingOptions(
            TrajectoryCostType trajectoryCostType,
            PoseCostType poseCostType,
            NativeArray <BoneData> currentPose,
            NativeArray <TrajectoryPoint> trajectory,
            NativeList <CurrentPlayedClipInfo> currentClips,
            NativeArray <int> sectionsIndex,
            NativeArray <SectionInfo> sectionDependecies,
            float trajectoryWeight,
            float poseWeight,
            int currentMotionDataGroupIndex
            )
        {
            this.trajectoryCostType = trajectoryCostType;
            this.poseCostType       = poseCostType;

            this.currentPose         = currentPose;
            this.currentTrajectory   = trajectory;
            this.currentPlayingClips = currentClips;
            this.sectionsIndexes     = sectionsIndex;
            this.sectionDependecies  = sectionDependecies;

            this.trajectoryWeight  = trajectoryWeight;
            this.poseWeight        = poseWeight;
            this.currentGroupIndex = currentMotionDataGroupIndex;
        }
示例#4
0
        public float CalculateCost(PoseData toPose, PoseCostType type)
        {
            float cost = 0f;

            for (int i = 0; i < Count; i++)
            {
                cost += bones[i].CalculateCost(toPose.GetBoneData(i), type);
            }
            return(cost);
        }
示例#5
0
 public void SetChangingOptions(
     PoseCostType poseCostType,
     ContactPointCostType contactCostType,
     NativeArray <BoneData> currentPose,
     NativeArray <FrameContact> currentContacts,
     float poseWeight,
     float contactWeight
     )
 {
     this.poseCostType         = poseCostType;
     this.contactCostType      = contactCostType;
     this.currentPose          = currentPose;
     this.currentContactPoints = currentContacts;
     this.poseWeight           = poseWeight;
     this.contactWeight        = contactWeight;
 }
示例#6
0
 public void SetChangingOptions(
     TrajectoryCostType trajectoryCostType,
     PoseCostType poseCostType,
     NativeArray <BoneData> currentPose,
     NativeArray <TrajectoryPoint> trajectory,
     NativeArray <float2> whereWeCanFindingPos,
     float trajectoryWeight,
     float poseWeight
     )
 {
     this.trajectoryCostType   = trajectoryCostType;
     this.poseCostType         = poseCostType;
     this.currentPose          = currentPose;
     this.currentTrajectory    = trajectory;
     this.whereWeCanFindingPos = whereWeCanFindingPos;
     this.trajectoryWeight     = trajectoryWeight;
     this.poseWeight           = poseWeight;
 }
        public float CalculateCost(BoneData toBone, PoseCostType type)
        {
            float cost = 0;

            //switch (type)
            //{
            //    case PoseCostType.Position:
            //        cost += CalculatePositionCost(toBone);
            //        break;
            //    case PoseCostType.Velocity:
            //        cost += CalculateVelocityCost(toBone);
            //        break;
            //    case PoseCostType.PositionVelocity:
            cost += CalculatePositionCost(toBone);
            cost += CalculateVelocityCost(toBone);
            //break;
            //    case PoseCostType.None:
            //        break;
            //}
            return(cost);
        }
        public float CaculateCost(FrameData toFrame, TrajectoryCostType trajectoryCostType, PoseCostType poseCostType, float responsivity = 1f)
        {
            float cost = 0f;

            cost += responsivity * this.trajectory.CalculateCost(toFrame.trajectory, trajectoryCostType);
            cost += this.pose.CalculateCost(toFrame.pose, poseCostType);
            return(cost);
        }