Example #1
0
 void Update()
 {
     if (throwObject)
     {
         animationProjectile += Time.deltaTime;
         //animationProjectile = animationProjectile % speed;
         transform.position = ParabolaEquation.Parabole(startPosition, endPosition, height, animationProjectile / speed);
     }
 }
Example #2
0
    private void ShowParabole(Vector3 aim)
    {
        parabolicProjectile = bullet.GetComponent <ParabolicProjectile>();
        endPosition         = new Vector3(aim.x * range, bullet.transform.position.y, aim.y * range) + player.position;
        parabolicProjectile.SetTarget(endPosition);
        int count = 20;

        Vector3[] arcArray = new Vector3[count + 1];
        for (int i = 0; i <= count; i++)
        {
            arcArray[i] = ParabolaEquation.Parabole(player.position, endPosition, parabolicProjectile.height, i / (float)count);
        }
        lr.positionCount = count + 1;
        lr.SetPositions(arcArray);
    }