- Home /
Character controller jitters when moving down the slope.
Hey guys, I followed a tutorial for a 3rd person controller so far everything seams to be working fine but only one issue, the game has a feature that lets you slide down hill, but for some reason for me it jitters/shakes like crazy, ive played around with the character controller values but it seamed to do nothing, i have no idea whats causing it to jitter that bad. I was wondering if anyone else had this issue and has a solution. Thanks in Advance.
Here is the code for the slide:
void ApplySlide()
{
if(!TP_Controller.CharacterController.isGrounded)
return;
slideDirection = Vector3.zero;
RaycastHit hitInfo;
if(Physics.Raycast(transform.position /*+ Vector3.up*/, Vector3.down, out hitInfo))
{
if(hitInfo.normal.y < SlideTrheshold)
slideDirection = new Vector3(hitInfo.normal.x, -hitInfo.normal.y, hitInfo.normal.z);
}
if (slideDirection.magnitude < MaxControllabaleSLideMaginitude)
MoveVector += slideDirection;
else
{
MoveVector = slideDirection;
}
}
Here is the link to the full Code in pastebin:
@$$anonymous$$usty
Did you ever get this working? I've just gone through this same tutorial and having the same jittering problem when it slides down slopes and I've no idea how to fix it :(
Your answer
Follow this Question
Related Questions
Unity 5 Character Controller Not Sliding Like in Unity 4 0 Answers
Check if the normal of a collision is within a range of angles 2 Answers
Sliding after moving 0 Answers
How to restrict to one axis 2 Answers