コード例 #1
0
        void Awake()
        {
            Actor           = GetComponent <Actor>();
            NN              = GetComponent <PFNN>();
            TargetDirection = new Vector3(transform.forward.x, 0f, transform.forward.z);
            TargetVelocity  = Vector3.zero;
            Positions       = new Vector3[Actor.Bones.Length];
            Forwards        = new Vector3[Actor.Bones.Length];
            Ups             = new Vector3[Actor.Bones.Length];
            Velocities      = new Vector3[Actor.Bones.Length];
            Trajectory      = new Trajectory(111, Controller.GetNames(), transform.position, TargetDirection);
            Trajectory.Postprocess();
            if (Controller.Styles.Length > 0)
            {
                for (int i = 0; i < Trajectory.Points.Length; i++)
                {
                    Trajectory.Points[i].Styles[0] = 1f;
                }
            }
            for (int i = 0; i < Actor.Bones.Length; i++)
            {
                Positions[i]  = Actor.Bones[i].Transform.position;
                Forwards[i]   = Actor.Bones[i].Transform.forward;
                Ups[i]        = Actor.Bones[i].Transform.up;
                Velocities[i] = Vector3.zero;
            }

            if (NN.Parameters == null)
            {
                Debug.Log("No parameters saved.");
                return;
            }
            NN.LoadParameters();
        }