Skip to content

Commit

Permalink
Converted units to DPI
Browse files Browse the repository at this point in the history
The previous coefficient for x distance calculation was 6. Converting to DPI gives similar results, meaning the typical DPI conversion is roughly 6.
  • Loading branch information
nlu6 committed Dec 7, 2023
1 parent b3d1dc6 commit d01516a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions JustJuggle/Assets/Scripts/JugglingObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void UpdateDestination()
framesUntilIntercept = timeUntilIntercept * fixedFPS;

// get current position of juggling object
double currentPos = jugglingObject.transform.position.x;
double currentPos = jugglingObject.transform.position.x * dpi;
double currentHeight = jugglingObject.transform.position.y * dpi;

// set throwing hand
Expand Down Expand Up @@ -217,10 +217,10 @@ void UpdateDestination()

// get x position of hand (hand location +/- deviation)
// this will make the look of the juggling more natural since the hands will not always be in the same place
destinationX = (destinationHand + UnityEngine.Random.Range(-(float)xDeviation, (float)xDeviation)); // convert to pixels
destinationX = (destinationHand + UnityEngine.Random.Range(-(float)xDeviation, (float)xDeviation)) * dpi; // convert to pixels

// save step size
xStep = 6 * Math.Abs(destinationX - currentPos) / framesUntilIntercept;
xStep = Math.Abs(destinationX - currentPos) / framesUntilIntercept;


// slow down time
Expand Down

0 comments on commit d01516a

Please sign in to comment.