Is there any way to repeat until not touching in Godot?

Godot Version

godot 4

Question

im still new to godot, and i am making a superliminal type camera. i have all the systems in place but the problem is that the raycast 3d destination puts the cube in the middle of the wall and the room space so it ends up being halfway inside the wall. is there a way to repeatedly move in a direction (maybe the raycast) untill the cube is not touching the wall? just knowing about a func like “is_colliding()” would help out a ton.

You could just move the cube half its size back the way it came. If you need more precission you can use the angle of the ray and the wall to calculate exactly home much to move back using trigonometry.

1 Like

this would work, ill try this. although for future reference do you know of any functions like i described above?

I don’t quite understand the question. You describe moving the cube into a wall and then using is_colliding(). If you can move a cube into a wall, you can move it backwards. If you can detect with body.is_colliding() you can tell when the opposite happens with not body.is_colliding(). Either your question answers itself or I don’t understand what you are actually asking for.