June 2018
Beginner to intermediate
298 pages
7h 38m
English
The aim could be improved by making the 180-degree swing of the arrow always begin by pointing towards the hole.
Add a variable called hole_dir to the Main script. At the start of aiming, this will be set to the angle pointing towards the hole using the following function:
func set_start_angle(): var hole_pos = Vector2($Hole.transform.origin.z, $Hole.transform.origin.x) var ball_pos = Vector2($Ball.transform.origin.z, $Ball.transform.origin.x) hole_dir = (ball_pos - hole_pos).angle() $Arrow.rotation.y = hole_dir
Remember that the ball's position is its center, so it's slightly above the surface, while the hole's center is somewhat below. Because of this, an arrow pointing directly between them would point at a ...
Read now
Unlock full access