0 votes

Okay so I am new to Godot and I have enjoyed the engine so far, but I can't figure out how to make a collectible item in a 3d game. All the tutorials and stuff I can find are for 2d games. The game I am making is a simple game where the player controls a ball and rolls around the level collecting cubes. My problem is that I can't figure out how to make the score increase when I touch a cube. I can change the text of the score easily but I don't know how to detect the collision between the player and the cube. I don't even know how to detect collisions in a 3d game. I also want the cubes to disappear when collected. Does anyone know how to detect the collision? I have already added the cubes to a group called coins if that helps at all. Can someone please help me?

asked Jun 4 in Engine by Dragon11705 (23 points)

1 Answer

+1 vote
Best answer

Most tutorials start out with 2D content for a reason - because 2D is easier to deal with when you're learning. Much of Godot's nodes work the same way in 2D and 3D. For example, the official 2D tutorial shows how to detect two object colliding:

https://docs.godotengine.org/en/latest/getting_started/step_by_step/your_first_game.html

The physics introduction gives more detail about the different types of collision nodes:

https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html

To summarize:
In 2D, you'd make the cubes Area2D nodes and connect the body_entered signal to detect the player picking them up. In 3D, the node is Area, and everything else is the same.

answered Jun 4 by kidscancode (11,190 points)
selected Jun 4 by Dragon11705

Oh I think I get it so I can just attach an area node to my cubes? I didn't realize that that was a thing I thought that area2d was a physics body. Maybe it is, but anyway thank you for the help I guess I'll attach an area node to my cubes and see what the tutorials have to say.

I tried it and it worked thank you for the help kldscancode :D

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.