The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

I would like to use a collision shape to detect whether there is room for the player character to move into a space before allowing the action to do so.

Therefore, I would like to use another collision shape, roughly the size of the player, which hovers ahead of the player character and is checked when the action is attempted.

As far as I understand things, CollisionShapes don't really work on their own, they must be children of a Node that can use them; for instance, my player's KinematicBody which contains collisionShape children that are used for moveandslide().

So my thought was to reparent my Player's KinematicBody to a Spatial Node which can then have another child of some kind that utilizes this separate floating CollisionShape. In this way, the new collisionShape would be a sibling, rather than a child, of my Player Node.

Would that be an efficient way to do this? Perhaps there is a better way to do this such that the new CollisionShape is still a child of my KinematicBody but is not used for moveandslide? And would the new CollisionShape need to be the child of a new 'Body' Node, such as StaticBody?

Thank you muchly for any ideas you might have!

in Engine by (16 points)

1 Answer

0 votes

Figured this out, added a child 'Area' node with it's own collision shape that is able to detect collisions independent of its parent KinematicBody.

by (16 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 Frequently asked questions and 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 [email protected] with your username.