0 votes

So, I have a kinematic body 3D (Which is a cube). I need to translate it every frame to where the ray hits. What it does right now is that it stays half-way in the ground or any object that it hits because it is translated to the exact point where the ray hits. So, how do I make it so it would be pushed out from ground or other object after translation? I tried everything (I also NEED to use translate on it, can't otherwise)

in Engine by (14 points)

2 Answers

0 votes

A kinematic body only collides when using its movement methods. You must use move_and_collide() or move_and_slide() to move it. translate() moves a Spatial object but will not give you any collision or separation.

by (21,716 points)
0 votes

You said you use a ray to detect objects (let's call them obstacles) and "teleport" your KinematicBody to their location. Why don't you simply get the location of the obstacles and translate the KinematicBody to their location + some offset. In other words, don't teleport the KinematicBody to Obstacle.translation.z, but teleport it to Obstacle.translation.z+offset

by (1,875 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.