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)

asked Aug 9 in Engine by StalinIsMyFriend (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.

answered Aug 9 by kidscancode (11,756 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

answered Aug 9 by johnygames (748 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.