0 votes

I'm quite new to Godot engine and new to game development in general.

So what i'm trying to do is to make my rigidbody character stick to the wall
but i couldnt manage to do it properly i've tried changing its mode to static or
changing sleeping state to true when touching a wall these worked but when my rigidbody touches to the wall with high velocity it sometimes stucks inside of the wall or it bounces and freezes in mid air
basicaly what im trying to do is i have a sticky rigidbody ball and i want it stick to a surface it touches

in Engine by (15 points)
edited by

If you want the ball to stick to any wall, you can check for wall collision in the code.

Check for whether the ball is colliding with a wall object via a body_entered signal. When this signal is fired off, use the body parameter of body_enteted and the name attribute of body to determine whether the object is a wall. Next, assign the position of the collision point to be the current position of the ball, and turn off any other movement code. When you want to move the ball, allow the ball to move again, and reinstate the movement code.

1 Answer

0 votes

I'm new too but maybe I can help. Because rigidbody responds to physics you'll probably need to make its mass zero and friction high and use add_force to "press" the body toward the surface.
Alternatively, depending upon the complexity of the shape you could convert it to a KinematicBody and add a raycast in each direction you want to stick. Then when you detect an imminent collision, manually set the position of the body to adhere to the surface.

by (18 points)

I've not tried this through altering the object's physics. I've only tried to freeze it when it touches a wall but this might actually work thank you Mark.
I was searching about continous collision detection to make it work
if altering physics work you would probably be my savior

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.