0 votes

I'd like to add a sensor sphere to my 3D player object (which is modeled as a kinematic body). While I don't want this sphere to be part of my player character's collision shape, I do want to be able to check it during the _physics_process() call to see if it is hitting any walls or other objects. What's the best way to do this?

My first attempt at this was to create an Area. I've tried monitoring the _on_body_entered() and _on_body_exited() signals, but there is a constant stream of objects entering and exiting my collision area. It would be better if I could simply ask during the _physics_process() call if there is anything intersecting with my sensor at that moment.

in Engine by (115 points)
edited by

1 Answer

0 votes
Best answer

Looks like Area.get_overlapping_bodies() was what I was looking for.

by (115 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.
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.