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

+1 vote

I'm very new to Godot so excuse me if I'm missing something obvious. I tried to implement a character that uses a rayshape for its ground collision. When I create a scene with a KinematicBody and any other shape it has no problem colliding with the StaticBody that I set up (both bodies only have CollisionShapes as children). However when I switch to RayShape the KinematicBody just goes right through it.

Looking at the manual page for 3D RayShapes, it says:

A ray is not really a collision body; instead, it tries to separate itself from whatever is touching its far endpoint. It’s often useful for characters.

Why is my RayShape then puncturing the StaticBody when it's part of a KinematicBody? Am I meant to read the collision manually through GDScript and separate it myself? If so, that doesn't really match the description in the manual and I think it would be redundant considering RayCasts already exist and have that behavior.

EDIT:
So after looking through the documentation further I realized my issue was with my call on "move_and_collide"

move_and_collide ( Vector3 rel_vec, bool infinite_inertia=true, bool exclude_raycast_shapes=true, bool test_only=false )

exclude_raycast_shapes is true by default and needs to be set to false to respond to rayshapes.
But now another issue arises in that while the rayshape now responds to its intended function of separating the physics body, the move_and_collide function does not report any collision. I'm not sure whether this is the intended behavior or not.

in Engine by (13 points)
edited by

Please log in or register to answer this question.

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.