-
Book Overview & Buying
-
Table Of Contents
Godot 4 Game Development Projects - Second Edition
By :
Since the ball needs physics – gravity, friction, collision with walls, and so on – RigidBody3D will be the best choice of node. Rigid bodies work similarly in 3D to the ones you’ve used before in 2D, and you’ll use the same methods to interact with them, such as _integrate_forces() and apply_impulse().
Create a new scene with a RigidBody3D node named Ball and save it.
Since you need a simple sphere shape and Godot includes primitive shapes, there’s no need for a fancy 3D model here. Add a MeshInstance3D child and choose New SphereMesh for the Mesh property in the Inspector.
The default size is much too large, so click on the Mesh property to expand it and set Radius to 0.05 and Height to 0.1.
Add a CollisionShape3D node and give it a SphereShape3D. Set its Radius setting to 0.05 to match the mesh.
Add an instance of the Ball scene to your course. Position it over one of the tiles and play the scene...