Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Actor Controller - an advanced character controller

Discussion in 'Assets and Asset Store' started by Tryz, Oct 13, 2015.

  1. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998

    Get it on the Asset Store!

    The Actor Controller is an advanced character controller for use in any type of game and with any type of character. It's a silky smooth replacement for Unity's default character controller that's built with simplicity and performance in mind.

    Advanced features include:

    • Walking on walls
    • Moving and rotating with platforms
    • Handling super-fast movement
    • Limiting and sliding on slopes
    • Orienting to the ground
    • Moving with nav meshes
    • Changing gravity
    • Customizable body shapes
    • Live state history
    • Complete code (C#)
    • and more...

    Demo Video:


    Quick Start Video:
     
    Last edited: Nov 20, 2017
    Mister-D, Gozdek and theANMATOR2b like this.
  2. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    As we wait for the AC to get approved, I thought I'd share another video . This time I'm talking about 'body shapes'.

    Body shapes allow you to customize the collision shape of your character. That's right... you're no longer stuck with just a single up-right capsule. ;)

     
    Last edited: Feb 10, 2017
    theANMATOR2b and hopeful like this.
  3. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,400
    This is great! I've been looking for an advanced character controller in Unity. :)

    So ... watching the video and seeing how the AC handles colliders, I found myself wondering if ragdoll colliders might be integrated. Or is this not the right place for that?
     
    Tryz likes this.
  4. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    637
    I'm having a lot of fun with the wall walking feature. Here's a fun experiment. Make a sphere about 500 meters across. Tessellate it to the limits of your computer's processing power, and then use the highest res DEM map of the Moon you can find to displace the mesh a bit. Add 8k diffuse and normal maps to texture it, and a low res spherical collider so you don't tilt at every bump and crater you hit. Viola! You're walking on your own mini-moon.

    Moonwalk.jpg

    You can substitute any other planet you have good topographic maps of, or make your own! Next up: a ring construct as seen in Halo. How about Mobius World? Spaghetti World? Escher World? The possibilities are endless, and so far, Actor Controller has handled them all without a hitch. Thanks Tim.
     
    Tryz and hopeful like this.
  5. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    haha... That's awesome!

    Still waiting for Unity's approval. :(
     
  6. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    As we're waiting for approval, I'm continuing to do more testing. I thought sharing performance and memory would be helpful.



    In this scene, there are 9 actors. When idle, the Actor Controller and driver are taking about 0.01 milliseconds. When actively moving and colliding with objects, they take about 0.03 milliseconds each. This last number can change as it depends if you have collisions enable, what the objects are colliding with, how fast actors are moving, etc.

    For 3 of the moving objects, you can see 80 bytes of garbage in the frame (per actor). Unfortunately, this is due to Unity's underlying physics calls (SphereCast, OverlapSphere, etc). However, 80 bytes is pretty small and even mobile devices should handle it well.

    There is already a request for "garbage free physics":
    http://feedback.unity3d.com/suggestions/garbage-free-physics

    Note: In order to capture stats and hook to the debugger, you have to create a development build vs. a release build. Development builds typically have overhead both from a performance and garbage standpoint.
     
    Last edited: Oct 21, 2015
  7. RussellFincher

    RussellFincher

    Joined:
    Sep 30, 2012
    Posts:
    50
    So excited for this. Does it usually take this long to get through the asset store?
     
    Tryz likes this.
  8. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,400
    It's normally between one and two weeks for approval, but various things can stretch out the time, like number of new asset submissions in that period, staff vacations, conferences, and stuff like that.

    So any day now. :)
     
    Tryz likes this.
  9. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Thanks! I'm excited to get it out. :D

    This is the longest it's ever taken. I was going to email Unity, but I noticed they updated their publisher site. As @hopeful mentioned, it now says "an average of 2 weeks". Tomorrow is officially two weeks. I figured I'll poke them on Friday if we don't see anything.
     
  10. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Whoo hoo! The Actor Controller is out! :D

    Thanks again @hopeful and @FargleBargle for the great testing help.

    As always, please let me know if you have any issues.

    Note: Remember that if you own the Motion Controller, you will get the AC for free once the Motion Controller v2 is released next month.
     
    theANMATOR2b likes this.
  11. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    2,157
    Woohoo! Grats on release!

    Question as far as the Motion Controller folks. Assuming it is going to be bundled in v2? Or will we get vouchers? Simply asking as far as ratings and reviews go since we can only do those based on what asset store sees that we purchased.
     
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    It will be bundled in the MC v2 package. We can only give 10 vouchers per product per year. So, I can't do it that way.

    As you mentioned, that will keep MC users from being able to write reviews on the AC. However, I felt that it was more important to provide MC users with the newest features and I don't think you should have to pay for v2. It may hurt the AC in the long run, but that's life and I'll live with it. ;)
     
    Shawn67 likes this.
  13. Xentar

    Xentar

    Joined:
    Apr 8, 2011
    Posts:
    22
    Looks like the videos are embed wrong... (saw them in youtube, but can't see them here or in the asset store description).
    I'm kinda interested on the wall walk, but... you need to jump so you can change surfaces? isn't possible to just walk and change axis/gravity?
     
  14. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Hey @Xentar, I can watch the videos here and on the asset store page in both Chrome and IE. What browser are you using?

    With the wall walk, it does work as you suggest. I think this video shows what you're asking about:


    I've included one of my development scenes in the package. In there, there's a ramp that goes from the floor to the wall and another from the wall to the ceiling. In those cases, the character just walks and rotates.

    The "spider driver" is a little different because I wanted him to be able to walk up to any obstacle and jump onto it (event if it's a 90-degree angle). However, he doesn't need to jump if we're just talking a 20 or 30 degree angle.

    By creating your own driver and telling the AC what to do, you could create a creature that doesn't need to jump at 90-degree angles.
     
    Last edited: Oct 28, 2015
  15. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,229
    this seems perfect for npc controls with complex action, do you have a roadmap about features you want to add? can i do controls for parkour player for example? ( climbing wall run and jump)
     
  16. Xentar

    Xentar

    Joined:
    Apr 8, 2011
    Posts:
    22
    @Tryz Hmm, now i can see the videos... (chrome) extrange.
    Uhm... but with a little change on the code is posible to let it adjust on a 90° angle? what i want is a spider that can walk over anything (any angle, surface, etc.), and if jump, fall.
     
  17. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,400
    Congrats on the new addition to the Ootii page in the asset store!

    The Actor Controller is great. I particularly like the wall walking abilities. You can configure it to respond in some slightly different ways by using the advanced settings.

    It also behaves pretty well for characters that move at high speed. :)
     
    Tryz likes this.
  18. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,400
    If I'm not mistaken, this was one of the reasons for making the Actor Controller. The plain Unity CC could get buggy in all kinds of different situations. The Actor Controller was designed to do a better job of navigating obstacles, so it ought to be a good match for acrobatics and parkour.

    When the Motion Controller v2 comes out, that's going to be an interest of mine. I want quality athletic movement for my game.
     
    Tryz likes this.
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    I see what you're saying... yes. It's totally doable..

    For us nerdy types, keep reading... :)

    The "driver" is responsible for telling the AC what to do. In the case of the demo, I've got a spider driver, the default actor driver, a nav-mesh driver, and several others.

    In the "Spider Driver" specifically, I call the AC.SetTargetGroundNormal() function to tell the spider how to orient. In my case, when you jump he shoots a ray forward, grabs the normal of the wall, and rotates towards it. In your approach, you'd constantly be shooting a ray forward, grab the normal if there's a hit, and use the SetTargetGroundNormal() function with that. Totally doable and pretty easy. You just have the small overhead of the constant raycasts.

    If there's one tricky part, I'd say it's rotating the character off the ground. In my approach, the jump takes the spider off the ground and he can rotate without having to worry about some collision stopping the rotation. In your approach the character would be on the ground and rotate to the new ground. Depending on the shape of your character, it might be an issue unless you move him up off the ground some. I hope that makes sense.
     
  20. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Hey @Damien Delmarle ,

    Exactly. As @hopeful mentioned, I had some frustration with the Unity character controller. The AC gives us more control over things like rotations, platforming, and shapes. I also created a couple of "drivers" that make NPCs easier to control with the AC

    For all your other questions, I think this will help...

    I've been a professional programmer for over 20 years. What I've come to love is the idea of component-izing things. So, I tend to build things that are responsible for specific tasks. By pulling different components together, we can do most anything.

    So, the AC is a component responsible for grounding, collisions, wall-walking, platforms, and general body shapes. It doesn't really know why you'd want to do these things... it just knows how to do them.

    The "drivers" (and the Motion Controller is an uber-driver) has specific goals... move here, play this animation, react to input. So, they know 'why', but they rely on the AC to figure out the 'how'.

    So, to your question about parkour: Absolutely the AC can be used as the foundation for parkour. However, you'll have to create a driver that tells the AC what to do and when. In my world, that's the Motion Controller (v2).

    A roadmap for the AC? Not really. That isn't to say there won't be new features added, but I think it's done. Now, my focus is on creating drivers that use it to accomplish things. Again, the big driver is Motion Controller v2.

    Ignoring the MC for a bit, the AC actually comes with several example drivers:
    1. Actor Driver - basic driver that takes input and moves a character around
    2. Animator Driver - takes input, but uses root-motion to drive the character
    3. Nav-Mesh Driver - doesn't use input. Instead, it uses Unity's nav mesh to control the actor
    4. Sphere Driver - controls a sphere and rolls it around like a giant ball
    5. Spider Driver - shows how to jump onto walls

    You can also create your own drivers that tell the AC what to do.

    This approach allows the AC to be used for any type of game and any type of character.

    I hope that answers all your questions.
     
    Shawn67 and theANMATOR2b like this.
  21. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,229
    do you mean that it mostly require motion controller to work out of the box?
     
  22. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    No, not at all.

    What I'm trying to say is that like the Unity Character Controller it doesn't know how to play an animation, read an Xbox controller, or know when to jump. Something has to feed it that information. That's what a "driver" does.

    I've included several drivers. However, if you are wanting something different than the drivers I've included, you'll have to create them. Just like with most other character controllers.

    The first video in this forum is done with only the AC (and included drivers). No MC at all.

    I'm hoping this video clarifies it a bit. It shows a character setup with just the AC and an included driver.


    I only mentioned the MC because you asked about parkour. That's a complex subject as you climb, jump, run up walls, flip, etc. The AC is a great foundation for that, but can't do all that without a special driver that would need to be created.
     
    Last edited: Feb 10, 2017
    Mister-D likes this.
  23. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    181
    Tryz likes this.
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Thanks @Dan2013

    I actually own it. So, once I finish up with a couple of things I'm doing now I will for that as well as Node Canvas. ;)

    Expect a couple of weeks though.
     
    Dan2013 likes this.
  25. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    181
    Nice!


    In addition, I saw you plan to provide driver for Unity's Nav Mesh.
    Would you explain a little bit what is the main technique you use to implement some customized Actor Motion moving logic (e.g. moving character objects in an Actor Motion way) into Unity's navigating process?
    For example, on a navigated character object, your driver code may call functions like NavMeshAgent.steeringTarget() or NavMeshAgent.NextPosition() to get some hints, and use ActorMotion.SomeMoveFunctions() to implement some customized moving logic?
     
    Last edited: Oct 29, 2015
  26. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Actually, the "Nav Mesh Agent Driver" is already part of the package. In the first video you'll see some spiders moving around on their own. They are using that driver.

    The functions you mentioned are exactly what I use. Basically I tell the Unity nav mesh agent that's on the spider to not move the character. Instead, my driver consumes the pathing information, translates that to "psuedo input", then passes that input to the spider's animator. The animator plays the spider's walk cycle based on the input and the resulting root-motion data is returned back to the driver. Using that information, the driver tells the AC to the spider.

    All the developer has to do is tell the spider's driver what position to go to and it all works with Unity's Nav Mesh. :)
     
  27. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    181

    Thanks a lot for your explanations. :)

    Some more questions for this statement, "resulting root-motion data is returned back to the driver".
    I am new to this kind of Root-Motion-driven character controller. Maybe I list some silly questions below.

    In the "wall walking" scenario, you didn't use "Apply Root Motion" option of Animator to move the character. Right?
    I think "wall walking" is a special customized function that cannot be implemented by using standard Root Motion of Unity Animator.

    Or, you even use Unity Animator's Root Motion to implement the "wall walking" function?
     
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    I do... What happens is when you have a script that uses the OnAnimatorMove function (from Unity's Monobehavior), it actually takes away that option. Instead, the Animator shows "Handled by Script". It's that driver's script that applies the root motion data OnAnimatorMove supplies.

    Actually it can... and I do. However, I massage the data first to ensure it's all moving in the right direction.
     
    Mister-D likes this.
  29. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    181
    Oh... I thought all Root Motion based controllers do depend on artists' walk/run animation clips to move characters.
    But I just realize that thought is not correct...
    I had a look at a post before that also mentioned this OnAnimatorMove().
    http://mecwarriors.com/2014/08/18/scripting-root-motion/
     
    Tryz likes this.
  30. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    You're not wrong. It's just that the OnAnimatorMove() function gives us the opportunity to massage the data the artist added in order to rotate and move the character. Then, you can apply the data directly.
     
  31. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    181
    I get it. :)
     
    Tryz likes this.
  32. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,356
    how easy would it be with your controller to make a climb on everything controller? basicly its walk on walls with a climbing animation.
    i really dig your work! we should make a game someday! ;)
     
  33. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Shouldn't be too hard at all. The controller can already orient to everything.

    The real trick will be the animations to make transitions look right. The spiders in the video were easy because I just had them jump. Having them walk up the 90-degree angle probably wouldn't be too bad as they are mostly spheres. However, having a human transition to a climb may take some animation muscle. :)

    Thanks. I like your models too. They have "character". I'm trying to get back to Hallow's Deep, but upgrading the assets has consumed me. :eek:
     
  34. uncones

    uncones

    Joined:
    Sep 19, 2015
    Posts:
    14
    Hi there,

    Is there a way the wall walking with spider occurs right after it collides with the wall without jumping? also, when on the top of the surface, to get down, how can I make it so it goes down the wall walking too instead of falling down?

    What do yo recommend me to do if I don't want to change the camera view when walking on walls?

    I'm trying to apply this to a 2D platform, side scroller.

    Thank you

    Thank you!
     
    Last edited: Nov 1, 2015
  35. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,400
    I agree this is a better way for it to work, but it's difficult to get the controller to do it. Maybe an improvement down the line can bring this functionality. There's maybe one or two other things I'd like to see improved, too, but it's good to have it out now with most of the desired functionality.

    For now ... it's fun to jump, and players like to have a little bit of room for developing expertise. :)

    As for going down the wall, IIRC sometimes you can get it to work if you go over the edge slowly. This is the sort of thing players will pick up on as they gain experience.

    Also, IIRC, you can jump from wall to ceiling, and ceiling to wall, without falling.

    Now, if your concern is managing wall-walking AI, I can see the difficulty. Probably you'd have to come up with ways to cheat.
     
    Last edited: Nov 1, 2015
  36. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Hey @uncones and @hopeful ,

    I'm getting a lot of requests for the "wall-walking without jumping". So, that will need to be the next feature after Motion Controller v2 is out.

    Walking down a corner should be doable too.

    In both these cases, we're just talking about doing some extra raycasts and then changing the "tilt" of the character based on what we find. All the pieces are there... I just need to spend a couple of days and connect/test them.

    So, expect a couple of weeks... but yes.

    Now, if you're a brave soul and
    ... feel free to email me and I may be able to walk you through it. tim@ootii.com :D
     
  37. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    I'm assuming you're using the "Follow Rig" I've included...

    The Follow Rig uses the actor's rotation when determining it's new position (line 122 in RigLateUpdate() function). It's that rotation and offset that always keeps it behind the actor as he walks up walls. So, that's what you want to modify.

    That said, I'm worried that if you don't stay with the character, they could go out of view. Can you describe more about how you would see the camera working? That will help me help you.
     
  38. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    637
    This is already possible, if you design your walls, or at least their colliders, to allow it. By using beveled edges at the base and top of the wall, you can easily transition from one orientation to another without jumping.

    Wall_Test.jpg
     
    Tryz likes this.
  39. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Great point! It's really just 80-degree plus differences that require a jump.

    Even if you want a 90-degree look to your floor/walls, you can add invisible colliders as @FargleBargle suggests.
     
  40. uncones

    uncones

    Joined:
    Sep 19, 2015
    Posts:
    14
    I really appreciate your answers, I am very new to unity. I am trying to create the wall walking in a 2D platform, I want the character, which is similar to the spider bot, to be able to walk on the wall but the camera will keep the side scroller effect. I am actually using another 2d platform kit but would like to add the wall walking from this project to see if I can achieve the climbing.

    I'm trying to do something that looks similar to the game below for camera and platform:



    From min 3:26 you can see how the character walks on walls but the camera rotates, keeping a side scroll sort of view and changing the walking plane.

    Is it possible to achieve that effect with your action controller kit? Could you point me in the right direction here what pieces I need to change to achieve this?

    Thank you.
     
    Last edited: Nov 2, 2015
  41. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Absolutely.

    First thing is the camera. I went ahead and created a simple "Scroller Camera Rig" for you. Just email tim@ootii.com with your Unity Order Number and I'll email you the camera. I'll also make it part of the next update for everyone.



    In the screen shot above, the spider's forward direction is to the our right. So he's moving forward up the ramp... just like the cute roach.

    The camera is pretty easy. It's just an offset from the spider. In this case, we're looking down the "z axis"... so, we back the camera up 8 units and set the look direction.

    Now the camera follows the character just like any good side-scroller should. ;)


    The next thing you'll have to look at is the controls for your character. I used the "Spider Driver" that I included, but you'll need to adjust it a bit. The reason is that I originally built it so pressing the "W" moves the spider forward. In our scroller game, pressing "W" does move him forward, but "forward" means to the right... That just feels a bit weird.

    So, you'd modify the input (or the Mecanim conditions) so the input drives the character correctly. Your kit may already do this. So, you'll have to look.


    That should be a good start to help you research. Again, shoot me an email with your order ID and I'll send you the camera.
     
  42. uncones

    uncones

    Joined:
    Sep 19, 2015
    Posts:
    14
    Hi Ootii!

    Thanks for your email. I went ahead and added the files to the respective folders, but I'm getting an error:

    'com.ootii.Cameras.ScrollerRig.Awake()' is marked as an override but no suitable method found to override.
     
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Rats. I'm working with some other updates you don't have yet. I'll send you another file in the morning.
     
  44. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    I had some great questions from @uncones about using the Actor Controller for 2.5D side-scrollers. So, I've done a couple of things:

    1. I just submitted an update to the AC (v 0.52) that includes:
    a. A simple side-scroller camera rig
    b. An example side-scroller driver (for the spider that walks on walls)
    c. A sample scene showing it all working

    2. Created a video explaining the how it all comes together.


    The Actor Controller was built to be used for ANY type of game and ANY type of character. But, you do have to help it understand the kind of game you're building. Hopefully the sample drivers I'm including will help you to understand how to leverage the AC for your game. ;)
     
    hopeful likes this.
  45. uncones

    uncones

    Joined:
    Sep 19, 2015
    Posts:
    14
    Hi ootii,

    Thank you very much for the updates, I really appreciate your enthusiasm with your project and answering questions. I will try this today. I guess I will only need to update the A.C instead of adding the files right?

    Thanks again.
     
  46. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Exactly! The new version is now available.
     
  47. RussellFincher

    RussellFincher

    Joined:
    Sep 30, 2012
    Posts:
    50
    Hey Tim, any idea what's causing this floating behavior when going around round corners? Just the default wall walking settings with gravity turned off.

     
  48. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Gravity definitely needs to be turned on for wall walking. That's what pulls you to the surface.

    When gravity "is relative" (that's a setting for wall walking), that changes the direction of gravity based on the normal of the ground under you.

    I'm wondering if as you're going around the corner the character is gaining distance from the ground. Since there's no gravity, nothing is pulling him back down.
     
  49. yanuaris

    yanuaris

    Joined:
    Oct 16, 2015
    Posts:
    61
    Whoa, So, in the event that i use minimum jumping height, will the object still orient itself to nearest wall?

    I'm in need of a system where if i hold a the key Shift, it'll alwyas orient itself to its ground...
    be it a 90 degree wall, a tiny slope, or having to turn and grab ledge from 90 -270 degree ++ ledge and walk upside down to the surface.... And jumping will allow me to bounce prependicular to the ground i am standing, and then rotate and return to the gravity as i fall down.

    Is this too elaborate? I think your design is great and i am in need of something specific....

    So far i've tried a few things and the character still fall when it approach something a deep slope and having to turn 90 degree plus to manuever the platform...
     
  50. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,998
    Hey @yanuaris ,

    For typical ground (< 80 degrees), the AC does the orienting automatically. When "Keep Orientation" is not checked, jumping will have you bounce perpendicular to the current ground and rotate to the "natural ground" (vector3.up).

    By default, the AC will fall if you walk off a ledge.

    What you're describing would be something you'd do inside a custom driver. Not elaborate at all, but it would be a custom driver.

    It sounds really close to what I do with the spider driver I created. Check out:
    Assets/ootii/ActorController/Demos/Code/SpiderDriver.cs

    The key is really one line (line 112):
    ActorController.SetTargetGroundNormal(mJumpToWallNormal);

    When you determine it's time to test for a wall (say when shift is held), you'd do a raycast to get the wall's normal and then call the function above. That will rotate the character for you over time (assuming you have enough room).

    The core part of the SpiderDriver.cs is 70 lines of code and that moves him, rotates him, and handles the jumping. I imagine your driver would be about the same.

    Feel free to email tim@ootii.com if you get stuck and I can help point you in the right direction.
     
    yanuaris likes this.