Finishing the scene
Now that you have the course laid out, two more items remain: the tee, or location where the ball will start, and a way to detect when the ball has entered the hole.
Add a Position3D node named Tee. Just like Position2D, this node is used to mark a location in space. Place this node where you want the ball to start. Make sure you put it just above the surface so that the ball doesn't spawn inside the ground.
To detect the ball entering the hole, you can use an Area node. This node is directly analogous to the 2D version: it can signal when a body enters its assigned shape. Add an Area and give it a CollisionShape child.
In the child's Shape property of the CollisionShape, add a SphereShape:
To size the collision sphere, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access