Search Unity

Question Butterfly/Fairy Point to Point Movement System

Discussion in 'Scripting' started by jae026, Nov 28, 2022.

  1. jae026

    jae026

    Joined:
    Oct 29, 2016
    Posts:
    68
    Goal:
    Create a waypoint system for a butterfly that mimics the actual movement of the butterfly/fairy. Instead of flying in a straight path, the butterfly would loosely follow the path banking, rolling and toward the next point.

    Issue:
    Most waypoint systems I have tried move in a very linear fashion. Even when using bezier curves, the movement is still very stiff.

    Things I Tried :

    Attempt 1 - Creating a system where the butterfly flies from one point to the next and upon reaching the next point it chooses between 2 paths that both lead to the next target. The attempt here was to make it feel dynamic but it just feels stiff.

    Attempt 2 - Creating a system where the butterfly flies from one point to the next and tween the x and y values using animation curves to simulate the unpredictable smoothed movement.

    Explorations:

    I have been considering using a boids like system where I would place objects in the environment to avoid and send the object from point to point. I have not started this but wanted some opinions.

    Ask:

    Is anyone familiar with any solutions that may exist or have any suggestions on how I can achieve this? I do not have the privilege of sharing code but I am willing to start over if need be.
     

    Attached Files:

  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,934
    I think this just needs a two layer approach. A root empty that follows the path, be it straight lines or curves, and the butterfly/fairy itself as a child of this root, that can be animated however you see fit.
     
    Yoreki likes this.
  3. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164


    At 2:43 there are some butterflies displaying movement as described.

    But how I would do it, say the butter fly is moving from point A to point B, it is external forces that are pushing the butterfly around into a perpetually unstable course. So I would just intercept it’s movements with a gust and recovery. And for each interception of gust that ocurrs he maybe flaps harder to try to recover the position he was at for a number of frames before it happens all over again. Perhaps gains some acceleration.