I’m trying to imlpement terrain climbing feature.
Due to the fact that terrain isn’t flat/straight, character will sometimes fly in the air and/or not face the terrain side that’s currently being climbed.
i’m casting a ray from character’s head forward to detect the wall, and setting look rotation on Y-axis to the hit.point of the ray.
Here’s a video to demonstrate the issue:
i1ic8t
One option i can think of is to maybe change the ray start from the head to the body since the head appears to be kinda shaking back and forth which may be the cause of the character sometimes getting a hit point, but then not being aligned. That is by far the simplest thing i can think of that may decreases the number of times that happens.
A more intricate way is to have a sort of intermediate “Alignment Function” that happens between the input detection and the climbing. Maybe a small animation that kinda recenters the character with the hit spot and gets them closer to the wall. So like an initial raycast like you have it, and then another raycast for the actual climb to assure the player is at the right spot? Idk, just sorta spitballing an idea
1 Like
hey sam! @Cornysam
moving the raycast to body is actually a good idea, i think the head could be causing part of issue, will try and let you know, even though this won’t solve the issue 100% but hopefully it’ll bring me closer.
i already tried an align function that detects the hit point and keeps lerping player towards that point during the climb (so player sticks to the terrain), which works great if you’re facing the terrain, but i need a way to let the character get the closest terrain point and look towards it if player tries to climb while not exactly facing the terrain (as u can see in the 2nd part of the video).
if you have discord we can think about a solution together (or maybe think of a better align function), if you have the time of course.
thank you anyway! I’ll put my align function here when I get back home so everyone can see it, hopefully I’ll get more input.
Im happy to help discuss possible solutions. Ill message ya my discord