Skip to main content
added 23 characters in body
Source Link
VaTTeRGeR
  • 786
  • 5
  • 17

I assume you know the basic maths stuff concerning angles, movement, distance and all the other stuff.

You have these goals:

  • reach destination
  • do random stuff
  • stay inside (rectangular?) area of playfield

Your plane could have these properties:

  • position pos
  • forward-speed vel
  • forward-acceleration acc
  • heading/rotation in degrees rot
  • angular velocity (rotation per second) rotVel
  • angular acceleration (change of rotation per second) rotAcc

Of which pos, vel and rot are chosen when spawning the plane and then never touched again by the random movement code and the others are used to steer it (randomly) towards it's target.

To move the plane, this is getting executed each tick (delta is the time between two updates):

vel += acc*delta; pos += vel*delta;vel*unitVectorOfAngle(rot)*delta; rotVel += rotAcc*delta; rot += rotVel*delta; 

So what you could do with this:

1. Loops and turns

You set rotAcc to a random positive or negative value, and leave it like that until you reach a randomly chosen Angle (or for a randomly chosen time or until you are heading towards a randomly chosen point, whatever works best) and then set rotAcc = -rotAcc to smoothly decrease your turnrate until rotVel is zero again. In the image, two example-paths are shown, red is the acceleration phase, green the deceleration phase.


[![loops and turns][1]][1] [1]: https://i.sstatic.net/L1QQW.png


2. Gliding back and forth

You set acc to a relatively big negative value and decelerate until you move back fast enough. Then you wait for a random amount of time and set acc to a high positive value until you reach your original speed again, then set it to zero.

3. Reaching your destination

You should constrain the randomness of your planes movement based on the time that has elapsed since it was started and the distance to your goal. just initiate the random moves less frequently and try to correct its path towards the target, by tweaking rotAcc.

4. Constraining the fly area

For countering situations in which the plane goes to near to a border, you could use a combination of gliding back and doing a fast loop or a manual turn.

5. Mix it up and time it

I can't help you there, you will need to figure out all the tweaking and timing out for yourself.

I assume you know the basic maths stuff concerning angles, movement, distance and all the other stuff.

You have these goals:

  • reach destination
  • do random stuff
  • stay inside (rectangular?) area of playfield

Your plane could have these properties:

  • position pos
  • forward-speed vel
  • forward-acceleration acc
  • heading/rotation in degrees rot
  • angular velocity (rotation per second) rotVel
  • angular acceleration (change of rotation per second) rotAcc

Of which pos, vel and rot are chosen when spawning the plane and then never touched again by the random movement code and the others are used to steer it (randomly) towards it's target.

To move the plane, this is getting executed each tick (delta is the time between two updates):

vel += acc*delta; pos += vel*delta; rotVel += rotAcc*delta; rot += rotVel*delta; 

So what you could do with this:

1. Loops and turns

You set rotAcc to a random positive or negative value, and leave it like that until you reach a randomly chosen Angle (or for a randomly chosen time or until you are heading towards a randomly chosen point, whatever works best) and then set rotAcc = -rotAcc to smoothly decrease your turnrate until rotVel is zero again. In the image, two example-paths are shown, red is the acceleration phase, green the deceleration phase.


[![loops and turns][1]][1] [1]: https://i.sstatic.net/L1QQW.png


2. Gliding back and forth

You set acc to a relatively big negative value and decelerate until you move back fast enough. Then you wait for a random amount of time and set acc to a high positive value until you reach your original speed again, then set it to zero.

3. Reaching your destination

You should constrain the randomness of your planes movement based on the time that has elapsed since it was started and the distance to your goal. just initiate the random moves less frequently and try to correct its path towards the target, by tweaking rotAcc.

4. Constraining the fly area

For countering situations in which the plane goes to near to a border, you could use a combination of gliding back and doing a fast loop or a manual turn.

5. Mix it up and time it

I can't help you there, you will need to figure out all the tweaking and timing out for yourself.

I assume you know the basic maths stuff concerning angles, movement, distance and all the other stuff.

You have these goals:

  • reach destination
  • do random stuff
  • stay inside (rectangular?) area of playfield

Your plane could have these properties:

  • position pos
  • forward-speed vel
  • forward-acceleration acc
  • heading/rotation in degrees rot
  • angular velocity (rotation per second) rotVel
  • angular acceleration (change of rotation per second) rotAcc

Of which pos, vel and rot are chosen when spawning the plane and then never touched again by the random movement code and the others are used to steer it (randomly) towards it's target.

To move the plane, this is getting executed each tick (delta is the time between two updates):

vel += acc*delta; pos += vel*unitVectorOfAngle(rot)*delta; rotVel += rotAcc*delta; rot += rotVel*delta; 

So what you could do with this:

1. Loops and turns

You set rotAcc to a random positive or negative value, and leave it like that until you reach a randomly chosen Angle (or for a randomly chosen time or until you are heading towards a randomly chosen point, whatever works best) and then set rotAcc = -rotAcc to smoothly decrease your turnrate until rotVel is zero again. In the image, two example-paths are shown, red is the acceleration phase, green the deceleration phase.


[![loops and turns][1]][1] [1]: https://i.sstatic.net/L1QQW.png


2. Gliding back and forth

You set acc to a relatively big negative value and decelerate until you move back fast enough. Then you wait for a random amount of time and set acc to a high positive value until you reach your original speed again, then set it to zero.

3. Reaching your destination

You should constrain the randomness of your planes movement based on the time that has elapsed since it was started and the distance to your goal. just initiate the random moves less frequently and try to correct its path towards the target, by tweaking rotAcc.

4. Constraining the fly area

For countering situations in which the plane goes to near to a border, you could use a combination of gliding back and doing a fast loop or a manual turn.

5. Mix it up and time it

I can't help you there, you will need to figure out all the tweaking and timing out for yourself.

Source Link
VaTTeRGeR
  • 786
  • 5
  • 17

I assume you know the basic maths stuff concerning angles, movement, distance and all the other stuff.

You have these goals:

  • reach destination
  • do random stuff
  • stay inside (rectangular?) area of playfield

Your plane could have these properties:

  • position pos
  • forward-speed vel
  • forward-acceleration acc
  • heading/rotation in degrees rot
  • angular velocity (rotation per second) rotVel
  • angular acceleration (change of rotation per second) rotAcc

Of which pos, vel and rot are chosen when spawning the plane and then never touched again by the random movement code and the others are used to steer it (randomly) towards it's target.

To move the plane, this is getting executed each tick (delta is the time between two updates):

vel += acc*delta; pos += vel*delta; rotVel += rotAcc*delta; rot += rotVel*delta; 

So what you could do with this:

1. Loops and turns

You set rotAcc to a random positive or negative value, and leave it like that until you reach a randomly chosen Angle (or for a randomly chosen time or until you are heading towards a randomly chosen point, whatever works best) and then set rotAcc = -rotAcc to smoothly decrease your turnrate until rotVel is zero again. In the image, two example-paths are shown, red is the acceleration phase, green the deceleration phase.


[![loops and turns][1]][1] [1]: https://i.sstatic.net/L1QQW.png


2. Gliding back and forth

You set acc to a relatively big negative value and decelerate until you move back fast enough. Then you wait for a random amount of time and set acc to a high positive value until you reach your original speed again, then set it to zero.

3. Reaching your destination

You should constrain the randomness of your planes movement based on the time that has elapsed since it was started and the distance to your goal. just initiate the random moves less frequently and try to correct its path towards the target, by tweaking rotAcc.

4. Constraining the fly area

For countering situations in which the plane goes to near to a border, you could use a combination of gliding back and doing a fast loop or a manual turn.

5. Mix it up and time it

I can't help you there, you will need to figure out all the tweaking and timing out for yourself.