Exemplo n.º 1
0
 void Awake()
 {
     Actor = GetComponent <Actor>();
     NN    = GetComponent <MANN>();
     //MotionEditing = GetComponent<MotionEditing>();
     IKStyle         = GetComponent <IKStyle>();
     TargetDirection = new Vector3(transform.forward.x, 0f, transform.forward.z);
     TargetVelocity  = Vector3.zero;
     PID             = new PIDController(0.2f, 0.8f, 0f);
     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(Points, Controller.GetNames(), transform.position, TargetDirection);
     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();
 }
Exemplo n.º 2
0
 public void Initialise()
 {
     IKStyle = GetComponent <SIGGRAPH_2018.IKStyle>();
     for (int i = 0; i < Files.Length; i++)
     {
         if (Files[i].Data == null)
         {
             Utility.Destroy(Files[i].Environment.gameObject);
             ArrayExtensions.RemoveAt(ref Files, i);
             i--;
         }
     }
     if (GetCurrentFile() == null && Files.Length > 0)
     {
         LoadFile(Files[0]);
     }
 }