예제 #1
0
    private Vector3[] LinePath(Vector3 start, Vector3 end)
    {
        const float MAX_HEIGHT = 1.5f;
        const float ONE_RANGE  = 0.05f;
        float       maxRange   = (start - end).magnitude;
        Vector3     now        = start - (end - start).normalized * ONE_RANGE;
        Vector3     center     = (start + end) / 2;                         //中心座標を求める

        center    = new Vector3(center.x, center.y + MAX_HEIGHT, center.z); //ベジエ曲線の制御点
        besieData = new BesieData(start, end, center);

        List <Vector3> vec3s = new List <Vector3>();

        do
        {
            now = Vector3.MoveTowards(now, end, ONE_RANGE);
            float t = (start - now).magnitude / maxRange;
            vec3s.Add(Utility.Besie(start, end, center, t));
        }while (now != end);

        return(vec3s.ToArray());
    }
예제 #2
0
    public MoveObject[] FallMove()
    {
        MoveObject[] moveObjects = new MoveObject[2];

        Vector3 start  = gameTask.playerTask.transform.position;
        Vector3 end    = transform.position;
        Vector3 center = (start + end) / 2 + Vector3.up * 2f;

        BesieData bData = new BesieData(start, end, center);

        Vector3[] poss = bData.Positions(20);

        GameObject player = gameTask.playerTask.gameObject;

        moveObjects[0] = new MoveObject(player, poss, 4f);

        Vector3 fallPoint = end - Vector3.up * StageCreateTask.Y_Scale;

        moveObjects[1] = new MoveObject(player, new Vector3[] { end, fallPoint }, 5f);

        return(moveObjects);
    }