Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Character Controller FPS Wall Running.

Discussion in 'Scripting' started by PLSMajesticUnity, Sep 7, 2020.

  1. PLSMajesticUnity

    PLSMajesticUnity

    Joined:
    Aug 30, 2020
    Posts:
    10
    Well hello, I started a 3D FPS Project and used a Character Controller rather than a RigidBody Player Movement and I want the Player to be able to wall Run and wall Jump I searched the media and all the Wall Running tutorials Demanded a RigidBody Movement.
    Is there a Reason for This.
    And if there is any body that can help me.
    Thanks.
     
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,556
    Hi @PLSMajesticUnity

    Nothing prevents you from using those tutorials, as the logic should be pretty much the same.

    I guess you could do a raycast or some other cast to both left and right direction, or use some other method to check contact to a wall. Then if you have enough forward velocity while in wall contact and not touching ground, don't add gravity force.

    Note that Character Controller's SimpleMove does apply gravity automatically so you might have to use Move instead.
     
  3. PLSMajesticUnity

    PLSMajesticUnity

    Joined:
    Aug 30, 2020
    Posts:
    10
    Thanks Helped alot
     
  4. UnrealGameDev

    UnrealGameDev

    Joined:
    Dec 5, 2020
    Posts:
    1
    I have the same problem, i even tryed to switch to the Rigid body it did not work help..
     
  5. SubicaBubica

    SubicaBubica

    Joined:
    Aug 9, 2020
    Posts:
    4
    I am using a character controller for my game, and I made wallrunning using just collisions. For example, when the player touches the wall, gravity is between -3 and -10, so he is falling slowly, make players' speed a little bigger and tilt the camera with animation. Just to mention that the character controller doesn't use OnCollisionEnter, instead, it uses OnControllerColliderHit. For tilting head in other directions, just add tag LeftWall and RightWall, so when the player touches the right wall, camera tilt into left happens and when the player touches the left wall, camera tilt into right happens.
    Hope I helped future visitors.

    Code (CSharp):
    1.     void OnControllerColliderHit(ControllerColliderHit hit)
    2.     {
    3.         if (hit.gameObject.tag == ("Wall"))
    4.         {
    5.             gravity = -10f;
    6.             speed = 17f;
    7.             //addd camera tilt here
    8.         }
    9.         else if (hit.gameObject.tag != ("Wall"))
    10.         {
    11.             gravity = -30f;
    12.             speed = 12f;
    13.             //remove camera tilt here
    14.         }
    15.     }
     
    Last edited: Feb 20, 2021
  6. SubicaBubica

    SubicaBubica

    Joined:
    Aug 9, 2020
    Posts:
    4
    If you are still looking for a solution, try to make wallrunning using collisions.
     
  7. PixelsAreBlue

    PixelsAreBlue

    Joined:
    Apr 22, 2021
    Posts:
    1
    How do i make it jump off walls?
     
unityunity