Esempio n. 1
0
 public override void _Process(float delta)
 {
     if ((int)root.rpm != 0)
     {
         var curve = new Curve3D();
         curve.UpVectorEnabled = true;
         for (int i = 0; i < 15; i += 5)
         {
             curve.AddPoint(new Vector3(Translation.x, root.height.GetNoise2d(Translation.x, Translation.z - i) * 20, Translation.z - i));
         }
         var offset = ((root.rpm * (float)Math.PI * 2.0f) / 60.0f) * 0.60f * delta;
         Translation = curve.InterpolateBaked(offset);
         LookAt(Translation + curve.InterpolateBakedUpVector(offset).Rotated(Vector3.Right, -(float)Math.PI / 2), Vector3.Up);
     }
     else if (Input.IsKeyPressed((int)KeyList.Z))
     {
         var curve = new Curve3D();
         curve.UpVectorEnabled = true;
         for (int i = 0; i < 15; i += 5)
         {
             curve.AddPoint(new Vector3(Translation.x, root.height.GetNoise2d(Translation.x, Translation.z - i) * 20, Translation.z - i));
         }
         Translation = curve.InterpolateBaked(32 * delta);
         LookAt(Translation + curve.InterpolateBakedUpVector(16 * delta).Rotated(Vector3.Right, -(float)Math.PI / 2), Vector3.Up);
     }
 }