Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Parkour [Wallrun, Ledge Climb]

Discussion in 'Scripting' started by zakdank, May 14, 2017.

  1. zakdank

    zakdank

    Joined:
    Jan 25, 2011
    Posts:
    46
    So I am looking to edit the default first person controller to get some parkour functions in there. I am starting with the wall run first as I think its a pretty staple part of parkour and then look at ledge grasping/climbing.

    I want to try get the same feel as the ParkourFortress TF2 mod (inspired by mirror's edge but a bit more wacky). There's a good example here at 0:31;


    So far my thought process is to have an if statement on the jump to check if they are attempting to wall run.... It seems to work without any issues;


    Code (CSharp):
    1.                     if (Input.GetAxis ("Horizontal") != 0 && !m_IsWalking) {
    2.  
    3.                         if (Input.GetAxis ("Horizontal") > 0) {
    4.                             direction = right;
    5.                         } else
    6.                         {
    7.                             direction = left;
    8.                         }
    9.  
    10.                         if (Physics.Raycast(transform.position,direction,out hit,1) && hit.transform.tag == "Wall")
    11.                             {
    12.                             m_Jump = false;
    13.                             wallRun(direction);
    14.                             }
    15.                             else
    But I am now stuck as to how I should do the wall run. The way its done on the parkour fortress mod allows the player to wall run around rounded corners (2:13 in the video above). I thought this could be done by applying a force in the direction of the wallrun and then modifying the y value but I feel like there may be better ways to do this...

    What's the best way to do this?
     
  2. zakdank

    zakdank

    Joined:
    Jan 25, 2011
    Posts:
    46
  3. sweetclimusic

    sweetclimusic

    Joined:
    Nov 11, 2016
    Posts:
    12
    Parkour's cool so I flagged to watch for answers, but then I searched google and github for Parkour then filter by C#, read about Lemma game which is all about the parkour AND has release the engine on github. --> https://github.com/etodd/Lemma
     
  4. Laperen

    Laperen

    Joined:
    Feb 1, 2016
    Posts:
    1,065
    is this using CharacterController or Rigidbody?
     
  5. zakdank

    zakdank

    Joined:
    Jan 25, 2011
    Posts:
    46
    Awesome, I will check this out!

    CharacterController
     
  6. TrickCoder13

    TrickCoder13

    Joined:
    Jan 21, 2019
    Posts:
    1
    Lol ive been searching for hours
     
  7. zakdank

    zakdank

    Joined:
    Jan 25, 2011
    Posts:
    46
    This is a 2 year old thread.... I ended up making a customer controller using various ray casts.
     
  8. artin2007

    artin2007

    Joined:
    Jan 1, 2020
    Posts:
    1
    bro, just do on collision enter and get the desired tag, then set the gravity variable to 0. do a on collision exit then set gravity to what you wanted