- Home /
Help with Climbing System
Hello, I'm currently developing a videogame for my final university project, and one of the main mechanics is a climbing system. I already have several funcionalities working but have currently hit a wall. I need help with the jumping out from the ledge (to another ledge or just to get out) and some other stuff. I have two scripts, one for the character movement and other for detecting ledges. The ledge detection works with raycasts and the movement works with a character controller and its Move() function. It's a lot of code, but what I need help with is:
how to make the player jump from the ledge he is in
how to align the player with the wall he is latched on (tried LookAt(raycastHit.normal) and everything similar to it, but it only works with the character facing the forward world vector)
positioning the player correctly with the wall (tried offsets but can't understand what I'm doing wrong)
I'll leave my code here, along with some gifs of my problems
PlayerController code: https://pastebin.com/jwrc5zHk
ClimbingSystem code: https://pastebin.com/gxLt3fmk
LedgeJumping GIF: https://gph.is/g/EvXDp7Z
In line 165 of the player controller he jumps when in a ledge
if (Input.GetButtonDown(jumpButton))
{
velocity = transform.right * 10 * inputDir.normalized.x + Vector3.up * jumpHeight;
controller.Move(velocity * Time.deltaTime);
}
LedgeAligning GIF: https://gph.is/g/Z2g7Qm4
In the climbing system I have commented code for positioning the player correctly but he jitters a lot, I think it's because of gravity but I don't understand what I can do.
I know it's a lot of problems and a lot of code, but any help is appreciated, even if it's telling me to start over ahah
One last GIF: https://gph.is/g/4D9YMOE
Your answer
Follow this Question
Related Questions
Unity Invisible Collision With Slope [Rotation Issue] 0 Answers
Raycasting from object rotation? 1 Answer
click to move workig script!! but pls help with rotation!! :( 1 Answer
How do I get an object to rotate around a different axis based on the raycasts hit angle? 0 Answers
Object jumps through roof when holding "Up" button? 1 Answer