Example #1
0
    // Use this for initialization
    void Start()
    {
        numUpdates     = 0;
        range          = PhysicsCalculator.calculateRange(boat, target);
        moving         = true;
        gunBallSpawned = false;
        initial        = true;
        lastMarker     = numUpdates;
        buffer         = 3;
        fixedTime      = Time.fixedDeltaTime;

        //calculate theta
        angle = PhysicsCalculator.calculateTheta(range, gunBallVelocity);

        //calculate the total time
        totalTime = PhysicsCalculator.calculateProjTime(range, gunBallVelocity, angle);

        //change angle to degrees
        angle          = angle * 180 / Mathf.PI;
        angleText.text = "Angle: " + angle + " degrees";

        //calculate Vx
        oldVx = PhysicsCalculator.calculateXVelocity(gunBallVelocity, angle);
        //calculate Vy
        oldVy = PhysicsCalculator.calculateYVelocity(gunBallVelocity, angle);
    }