0 votes

Good day all,

I have a minimal project with an arrow and a disc. The Disc is an Area2D, the Arrow a RigidBody2D.

The Arrow is triggered/fired upwards/towards the Disc by a button press, and should impact/collide with the Disc. The Disc should signal "hit" and a print should be logged.

This is not happening, and I've investigated and reconfigured the project to have the Node types swapped (Arrow as Area2D and Disc as RigidBody2D) with little to no difference.

The Disc's on_body_entered(body) is never triggered.

I have two minimal representations of this issue, one with the Arrow as a child of main, the other with it instanced:
- BasicDemo-Child
- BasicDemo-Instanced

Any and all help will be greatly appreciated!

Godot version v3.3.2.stable.flathub
in Engine by (15 points)

1 Answer

0 votes
Best answer

I think it's because you are moving the Rigidbody with code and you shouldn't directly.
Maybe what you want your arrow to be is KinematicBody2D

have a look at this: USING KINEMATICBODY2D

You can see the collision detection work in your code by doing this:
Comment out translate(velocity * delta) in your Arrow.gd script.
Place the arrow on top of the wheel in the 2D view and run the project.
You will get a collision.


by (1,963 points)
selected by

Thanks, @deaton64! That was it!

I suspected it was because I'd made the Arrow the RigidBody2D, but nothing I tested fixed the problem for some reason. I must've missed this!

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.