I solved it
Getting a variable timed Interval with coroutine and yield?
Hello there,
I am trying to do a Physical Dragonflight simulation and want that my Dragon goes up in an interval depending on time. For Example i want a Flap on each 1.5 second. At the Moment i use a Coroutine:
 IEnumerator Flapping ()
     {
         Flaps += 1;
         Dragon.AddForce(Vector3.up * lift, ForceMode.Impulse);
         yield return new WaitForSeconds (1.5);
         Dragon.AddForce(Vector3.up * lift, ForceMode.Impulse);
         Flaps += 1;
         yield return new WaitForSeconds (1.5);
         endCoroutine = true;
     }
I call the Coroutine if i controll to fly upwards with this peace of Code:
 void flyhigh (float heightadjustment)
     {
         print ("Flaps: " + Flaps);
 
         if (endCoroutine == true) {
             StartCoroutine (Flapping ());
             endCoroutine = false;
         }
The Code works actually but not the way i want it. The first time i call the function it works just fine but if i call flyhigh() continously it ignores the yield after the first time. Hob anyone can help me :) Thanks in advance!
Follow this Question
Related Questions
yield ends method 0 Answers
Read force/pressure applied to a fixed RigidBody 2 Answers
How to apply a force at certain point of an object? 0 Answers
Collision Detection with DrawMeshInstanced 0 Answers
Real aerodynamics moving surfaces 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                