The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

I'm creating a 3D third-person game and I'm using a KinematicBody with a CapsuleCollider.

I've got some basic movement going, with gravity and so on, but when I try moving up slopes in my terrain, movement is extremely slow and similarly, when I walk down slopes, movement is way too fast.

Is there a simple way to fix this other than doing a bunch of complex RayCasting, querying the slope collisions etc?

Thanks in advance!

in Engine by (118 points)

1 Answer

0 votes
Best answer

So, I've implemented the solution I mentioned and behold - it works fine!

  1. Add a RayCast as a child of your KinematicBody and have it collide with your walkable environment/terrain.

  2. Each frame, move it forwards relative to the wanted movement direction.

  3. check for a collision down towards the terrain and get the collision point.

  4. If the collision_point.y > kinematicbody.translation.y, apply vertical movement to our velocity.

Thanks me!- you got this! xD

by (118 points)
selected by
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.