- Home /
How to stop player from climbing/sticking to walls
My player is able to climb walls, which he isn't supposed to do, which is shown below
By looking around, one of the main solutions is to add a physics object with no friction, which I added to the wall
But, it still doesn't work and i'm not sure how to fix this
Answer by BenWiller1989 · Sep 05, 2020 at 09:14 PM
Do you have any Gravity Manager at all, like a Rigidbody or some down-force? Also, you could send out a Ray, that stops the input forward movement after a certain small distance.
@BenWiller1989 I have a gravity script
controller = GetComponent<CharacterController>();
if (controller.isGrounded)
{
VerticalVelocity = -gravity * Time.deltaTime;
if (Input.GetKeyDown(KeyCode.Space))
{
VerticalVelocity = jumpforce;
}
}
else
{
VerticalVelocity -= gravity * Time.deltaTime;
}
Vector3 moveVector = new Vector3(0, VerticalVelocity, 0);
controller.$$anonymous$$ove(moveVector * Time.deltaTime);
You know you can test, if it works, by just lifting your player up in the Scene view window, while your game is running. Does it work, your gravity script ?
@BenWiller1989 It does, and im also curious about what you said here "Also, you could send out a Ray, that stops the input forward movement after a certain small distance." what is a ray? I am quite new to unity