Skip to content

Billiards Task Abstract Class

matthewi98 edited this page Jul 19, 2022 · 1 revision

Parent class of Pinball, Tooltask.

Setup:

  • Finds gameobjects: Surface, TimerIndicator, Scoreboard.
  • Subtracts surfaceTilt from cameraTilt to make JSON more intuitive (as surfaceTilt rotates everything including the camera).
  • Sets whether or not the current trial is a practice trial.

Protected Methods

SetTargetPosition:

  • Places the target using targetAngle and TARGET_DISTANCE.
  • Angle in degrees.
  • 90 degrees is straight forward, while <90 is to the left, and >90 is to the right.

SetTilt:

  • Rotates an object obj around an axis axis by angle angle in degrees.

SetSurfaceMaterial:

  • Sets the material of the GameObject in the scene named "Surface" to material.

CalculateScore:

  • Calculates score based on distance to target.
  • Returns a float between 0-1 calculated linearly using currDistance, multiplied by MAX_POINTS.

GetMousePoint:

  • Returns the position of the mouse projected onto the surface plane.
  • Quicker way of calling CursorController.MouseToPlanePoint().