Exemple #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;
            }
        }
Exemple #2
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;
        }
Exemple #3
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;
 }
        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);
        }
        public float CalculateCost(Trajectory toTrajectory, TrajectoryCostType type)
        {
            float cost = 0f;

            for (int i = 0; i < Length; i++)
            {
                cost += points[i].CalculateCost(toTrajectory.GetPoint(i), type);
            }
            return(cost);
        }
Exemple #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 float3 CalculateVectorCost(TrajectoryPoint point, TrajectoryCostType type)
        {
            float3 cost = float3.zero;

            switch (type)
            {
            //case TrajectoryCostType.Position:
            //    cost += CalculatePositionVectorCost(point);
            //    break;
            //case TrajectoryCostType.Velocity:
            //    cost += CalculateVelocityVectorCost(point);
            //    break;
            //case TrajectoryCostType.Orientation:
            //    cost += CalculateOrientationVectorCost(point);
            //    break;
            //case TrajectoryCostType.PositionVelocity:
            //    cost += CalculatePositionVectorCost(point);
            //    cost += CalculateVelocityVectorCost(point);
            //    break;
            //case TrajectoryCostType.PositionOrientation:
            //    cost += CalculatePositionVectorCost(point);
            //    cost += CalculateOrientationVectorCost(point);
            //    break;
            //case TrajectoryCostType.VelocityOrientation:
            //    cost += CalculateVelocityVectorCost(point);
            //    cost += CalculateOrientationVectorCost(point);
            //    break;
            case TrajectoryCostType.PositionVelocityOrientation:
                cost += CalculatePositionVectorCost(point);
                cost += CalculateVelocityVectorCost(point);
                cost += CalculateOrientationVectorCost(point);
                break;

            case TrajectoryCostType.None:
                break;
            }
            return(cost);
        }
        public float CalculateCost(TrajectoryPoint point, TrajectoryCostType type)
        {
            float cost = 0;

            //switch (type)
            //{
            //case TrajectoryCostType.Position:
            //    cost += CalculatePositionCost(point);
            //    break;
            //case TrajectoryCostType.Velocity:
            //    cost += CalculateVelocityCost(point);
            //    break;
            //case TrajectoryCostType.Orientation:
            //    cost += CalculateOrientationCost(point);
            //    break;
            //case TrajectoryCostType.PositionVelocity:
            //    cost += CalculatePositionCost(point);
            //    cost += CalculateVelocityCost(point);
            //    break;
            //case TrajectoryCostType.PositionOrientation:
            //    cost += CalculatePositionCost(point);
            //    cost += CalculateOrientationCost(point);
            //    break;
            //case TrajectoryCostType.VelocityOrientation:
            //    cost += CalculateVelocityCost(point);
            //    cost += CalculateOrientationCost(point);
            //    break;
            //case TrajectoryCostType.PositionVelocityOrientation:
            cost += CalculatePositionCost(point);
            cost += CalculateVelocityCost(point);
            cost += CalculateOrientationCost(point);
            //break;
            // case TrajectoryCostType.None:
            //break;
            //}
            return(cost);
        }