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?

in Engine by (31 points)

1 Answer

+2 votes
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:


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


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.

by (20,673 points)
selected by

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.