0 votes

Hello, i'm having some trouble trying to make this work. I have a bullet scene and a character that shoots the bullet etc. The bullet is a RigidBody2D and the player shooting the bullet is a KinematicBody2D. Is there anyway to check if the instanced bullet has collided with an enemy (KinematicBody2D)?

I added the enemy to a group called "Enemy" Can I detect the collision from the RigidBody2D in groups? like in the KinematicBody2D you can detect collisions with isingroup("Enemy")

Is there any way to do this with a RigidBody2D?

asked May 12, 2017 in Engine by Kavi (22 points)

1 Answer

0 votes

You need to enable contact monitor and set the contacts reported "> 0".

Then use get_colliding_bodies
http://docs.godotengine.org/en/stable/classes/class_rigidbody2d.html#class-rigidbody2d-get-colliding-bodies

Then you can operate with the array elements the same way as with KinematicBody2D.


Rigids also have body_enter and body_exit signals too to report contact.

answered May 14, 2017 by eons (7,786 points)
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.