Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

WIP Unity 5 Standard Third Person Procedural Climing.

Discussion in 'Works In Progress - Archive' started by S-P-A-C-E-D, Mar 5, 2015.

  1. S-P-A-C-E-D

    S-P-A-C-E-D

    Joined:
    Jan 11, 2014
    Posts:
    45
    I'd love to see more climbing in games. There are many ways to do it, one of which requires setting trigger boxes everywhere you can climb and that becomes daunting. And since I'm lazy I made a procedural climbing script. I've only add a few lines to the third person character script to prevent rotation and gravity.

    The last thing I've done is allow very tiny ledges to be grabbed. Ledges with a height of at least .06 scale (relative to the default cube size) and a length(front to back) of .2. The next thing I will do is add IK to the hands and feet.

    I would love to hear what you guys think. Could you use it? Have you tackled procedural climbing before? How did you do it?

     
    John-G and Mister-D like this.
  2. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    nice
     
    S-P-A-C-E-D likes this.
  3. S-P-A-C-E-D

    S-P-A-C-E-D

    Joined:
    Jan 11, 2014
    Posts:
    45
    Thank you. Anyone have any critiques or comments? Feature suggestions? etc.
     
  4. Spoken_OS

    Spoken_OS

    Joined:
    Feb 15, 2015
    Posts:
    29
    Looks really awesome. Can you jump down and grab a ledge below the one you are currently on? Do you plan on selling this on the asset store? I would buy something like this. Especially since it seems to be working pretty smooth.
     
    Last edited: Mar 5, 2015
    S-P-A-C-E-D likes this.
  5. S-P-A-C-E-D

    S-P-A-C-E-D

    Joined:
    Jan 11, 2014
    Posts:
    45
    Yes. You can drop from a ledge and catch another ledge below. You can jump off from the ledge and catch one above or in any direction. If you were to jump straight up and then wait til the lower one, you could catch it.

    And I would like to sell it on the asset store when it is ready. But I'm not sure over what price I should make it. I've also thought about adding more features.
     
  6. Spoken_OS

    Spoken_OS

    Joined:
    Feb 15, 2015
    Posts:
    29
    Keep us updated!
     
    S-P-A-C-E-D likes this.
  7. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Looks good, will make a nice addition to the asset store.
     
  8. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,557
    Wow. I was just thinking about how to implement climbing yesterday.

    Overall - i think the procedural solution is definitely the way to go. Your example looks like you've covered all the basic - climbing around a variety of shapes and a generous grabbing trigger. I'm really impressed.

    nitpicks and thoughts since you asked:
    • my biggest question is can this work on objects that are not cubes. I have an open world wilderness and id like people to be able to climb the rocks.
    • What about a terrain? will your system automatically start climbing if you come up to a sheer cliff?
    • Do you have to do anything to the climbable objects to prep them? or do you just drop a component on your character and the climbing works?
    • How's performance? does it work on mobile?
    • It might look more realistic if the grab trigger was smaller, that way when he grabs an object he almost miss he wouldn't "bounce up" as obviously. BUT this would probably make it very frustrating if we had to exactly grab the object with a less forgiving margin of error.
    • The only other motion thing i noticed (everything else is pretty much perfect) was when he shimmied across that rounded top. I LOVE that he moved up, along, and down with the curve of the surface. But it would look good if his hand more connected. right now it seems like his hands are always at the same height as each other - the left is the same height as the right, even when the surface he's grabbing is sloped.

    If i could get this to work in terrain I would instantly buy this. Like in the image below, could teh character climb those rocks? what about the terrain slope beside them? could we set a slope number after which the character would automatically begin climbing?

    I don't have a suggestion for a price - it depends on how robust it is. Starting at 10 bucks? 20 if it's robust? dont follow me those are just the prices i tend to feel comfortable with paying on the asset store, but i will drop 604 or more if its a very, vert fleshed out system (like terrain composer)

    Simplicity is also a factor, like i was mentioning is this just a drag and drop script? is it hard to implement?

    I'm following this:) Thanks for sharing and keep it up

    Could we climb the rocks in this pic? what about the terrain? for scale notice the little man in the center of the screenshot, standing on the rocks.
     
  9. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    I love it! I haven't had the courage to even modify the 3rd person animations yet, let alone adding new functionality! Well, I did have to add the Toggle Walk By Default option in, since that seems to have been removed from the Beta version of the assets, but still.

    If it was structured in such a way that I could add it as a new component and not just replace my existing TPC component, I'd probably be willing to shell out a couple of bucks for this!
     
  10. S-P-A-C-E-D

    S-P-A-C-E-D

    Joined:
    Jan 11, 2014
    Posts:
    45
    Sorry for the late reply, I've been very busy.

    As it stands the criteria for a grab-able ledge is that the initial wall must be vertical, there must not be something above it for about .1 distance going away from the wall normal. The reason for the wall being vertical is to prevent it from thinking a slope is a ledge. I am working on a few things at the moment, one of them is a different way of detection that will allow more situations. Of course you can take out that vertical wall check but you may get some undesired results... Or maybe in your case it'll be more desired if your rock is curved and you still want to be able to grab it.


    Unless that cliff had protrusions of at least .2 or .3 height (relative to the default cube scale) and enough space to grab it could probably do fine catching it, then you could shimmy and jump to the next one. But complex geometry could have so many weird angles that it could have some wonky effects. The big thing here is the collision geometry. I would personally use a different system for climbing up a cliff wall. Maybe even then for better results you could set up trigger boxes and if the raycast hits it, then make that the location you climb to. Or even better than that, you might could check for the layer or tag of the raycast hit and if it is a cliff object have slightly different behavior happen. It isn't really intended for rock climbing sort of things. But if you were careful with your level collision design, you could probably make it work.

    No, but it would help to design your level colliders with intent and make it simple. Which is something you should probably do anyways. It will detect edges on mesh colliders but they can be complex and give some strange results around intricate areas. And again I'm still working on improving everything about it, so it will hopefully just get better.

    I have not tested it on mobile. There is a good amount or raycasts going on. I try to only do it when necessary and it is something I'm still going to optimize further. I just have no clue how it would perform on mobile.

    I'm looking into solutions for the "bounce up" as well. Like you said, it is a bit of a give and take between the distance allowed to grab a ledge and the potential to be falling faster than it pulls you up when it catches. There was one method that would eliminate it almost entirely how ever it makes it difficult to grab ledges that have ledges shortly above them.

    In that video, I hadn't begun to integrate Inverse Kinematics. I'm still working on making it look right, as it isn't as simple as having it stay on the target. But I do have a little video, someone had asked to see the progress.



    Again, it will hopefully only continue to improve.

    I think I could say honestly that this method isn't the best for what you are trying to do. What you are trying to accomplish might actually be much easier, or much more difficult depending on the accuracy you want.

    And it is just a script so far, but there are a few lines I've added the Third Person Controller that comes with Unity 5. These are necessary to prevent gravity from pulling you down and stop unnecessary rotations from happening.

    As far as the picture goes. It would certainly catch some of those places, but I wouldn't bet a game on it. It really depends on how you handle the collision geometry. But in the end anything with natural structures and shapes, you want to be really careful how you handle climbing. This sort of edge finding and climbing is better for urban situations, or places with certain ledges.

    Lastly, I'm still working on hand IK and from then on out I believe I will be tweaking and polishing it until I feel it is ready for public scrutiny. I'll do my best to keep you updated!
     
  11. S-P-A-C-E-D

    S-P-A-C-E-D

    Joined:
    Jan 11, 2014
    Posts:
    45
    They actually changed the ThirdPersonCharacter.cs script quite a bit, I was surprised. I forgot to mention, but I did add back in a few lines from the old one in regards to their HandleAirVelocities or what have you. They made it almost entirely momentum based, so if you were on a wall I had to either add force to get you to be able to jump to another ledge, or simply return a little air control to the player.

    Do you still have the Sample Beta Assets TPC? It should still be compatible with it, but you would need to add a few lines to handle gravity and ApplyExtraRotation.

    If you have messed with the new Third Person Controller, have you noticed the guy is smaller than before? I imported some assets from unity 4 and noticed he looks like a foot shorter. I actually had to adjust some numbers to get my guy to line up with the ledge better. That's one thing I'm going to clean up, is to make it based on height not just some number that I tune to match.
     
  12. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    Interesting. I didn't notice that. Once I noticed the Walk by Default option was missing, I just opened the Beta version and copied that line or two over. I did notice that jumping seems weird now, and it's really tough to jump up onto ledges if you start off too close to them.

    I sent you a PM, @NewTimeBurnout so as to not hijack this thread. If you ever felt like writing an in-depth blog post about extending the Standard Third Person Controller, I'd be a big fan of that article. ;)
     
    theANMATOR2b likes this.
  13. S-P-A-C-E-D

    S-P-A-C-E-D

    Joined:
    Jan 11, 2014
    Posts:
    45
    They did a few things different. They lowered the jump height and they decreased the movement in air to being momentum dominated vs input affecting it so much. They had some other structural changes, I also noticed steps can be a pain to walk up.
     
  14. S-P-A-C-E-D

    S-P-A-C-E-D

    Joined:
    Jan 11, 2014
    Posts:
    45
    Spoken_OS and AthosK like this.
  15. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    I was going to link you to this guys thread to see if you and him could combine knowledge and put out one solid asset instead of competing with each other, one upping each other with added features.
    :)
    Keep up the good work.