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

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:
    3,402
    Hey @quarzwar ,

    It's been over a year since I looked at UFPS. So, I popped it open and did a quick look and there's a couple of things that would have to happen.

    1. AC would need to exposed some properties that UFPS uses:
    velocity
    radius
    height
    center
    enabled
    stepOffset
    slopeLimit

    2. UFPS would need to be modified to call AC instead of Unity's Character controller. This would include the properties above and the Move() function.

    3. Even then, you'd have to do a lot of testing. For example, the AC is built to go on walls and upside down. I'm not sure if UFPS and its camera can handle that. There's a lot of code in the AC and UFPS and there's bound to be a quirk somewhere.


    For #1, it would probably be easiest to create a new component that bridges the AC and CC and returns AC values when the properties are called for. That's a simple enough task.

    For #2, UFPS code would actually have to change. Instead of grabbing the "CharacterController" component, it would need to grab the "AC_CharacterController" bridge from #1.


    So, if you purchase the AC, I'm willing to do #1. However, you'll have to do #2 and #3... and there's still no guarantee everything will just work smoothly... it should, but this is software. :)

    Let me know what you think.
     
    BackwoodsGaming likes this.
  2. LividTheDream

    LividTheDream

    Joined:
    Sep 29, 2012
    Posts:
    17
    Hi,

    Using the AC_Demo1 scene I noticed some weird issues using the Player Capsule and Player Sphere and a custom mesh I'm using for the level where the player sticks to some walls. If I jump, even without moving towards the wall, the jump will lose momentum early and I can keep doing this usually for about 4 meters. Sometimes it might slowly slide down and others it will just stay against the wall. This doesn't happen with the Player Robot in the scene nor with the meshes included in the demo scene, and I didn't change any settings in the player capsule other than adding the terrain. I also tried this in a scene I created from scratch and the bug was still present.

    I've added a Mesh Partitioner to the environment mesh and there was no change. The only thing I can see is that in the ProcessGrounding function of ActorController, around line 3570 it returns a hit with the wall because a few lines earlier it makes lRayDirection horizontal having found the lToClosestPoint on the wall. I drew a debug vector showing the raycast from the capsule in the ground check to the intersection point:

    wall collision.jpg

    I also tried changing Orient to Ground to see if this his would change the capsule's orientation and it didn't.

    [Edit] I just tried this with an environment I created using the Pro Core builder and I get the same bug. It seems to happen with very tall walls.

    If this is a bug you're not aware of would you mind if I send you the custom mesh that's causing the issues?

    Thanks!
     
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Yeah, that's pretty odd. If you'll send the mesh to tim@ootii.com, I'll take a look at it.

    Since it's only happening with the the PlayerCapsule and not the PlayerRobot, I'm thinking it has something to do with the BodyShape's capsule being the same size as the AC's "Grounding Radius". That may be something to try as well, but please send me the mesh just in case.

    Thanks for being patient. :)
     
    theANMATOR2b likes this.
  4. tchris

    tchris

    Joined:
    Oct 10, 2012
    Posts:
    133
    Is it possible to give an AI a target that's on top of a wall and they will be able to walk up the wall to get to it. I tried to give an AI the SpiderAIDriver and set a target that's on top of the wall but it doesn't walk up the wall.

    I am working with the example scene AC_Navmesh. I just gave the rabbit character a Spider AI Driver script and filled in the target. I also tried making an Input gameobject with a Navmesh Input source and placed that in the Input Source Driver on the Spider AI Driver but that did not help.
     
  5. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    There's no built-in logic that would do that.

    That would require some custom logic that would know how to tilt while trying to reach the higher/lower target position. It's doable, but I haven't written that code.

    Unity is coming out with nav meshes that can go on walls and the ceiling. I haven't played with them yet as it's still in beta, but it looks promising as well.
     
  6. tchris

    tchris

    Joined:
    Oct 10, 2012
    Posts:
    133
    Cool I was just curious. Thanks for the info.
     
    Tryz likes this.
  7. JosephHK

    JosephHK

    Joined:
    Jan 28, 2015
    Posts:
    40
    Hi, I found some grounding issues. Please take a look to the video.

     
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Thanks @JosephHK ,

    I made some changes a while back and forgot to update the capsule and sphere on the demo.

    The "Grounding Radius" should be smaller than the body shape radius values or you'll get grounding results first. They were both set to "0.5". I changed the Grounding Radius to "0.45" and all is good.

    I'll make sure to update the demos.
     
    JosephHK likes this.
  9. JosephHK

    JosephHK

    Joined:
    Jan 28, 2015
    Posts:
    40
    Thanks for your quick reply.
    Besides, I would like to know whether there is any way to update the actor controller manually?
    Could you give a small example script?
     
  10. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I'm not sure what you mean by "manually", but I show example code in the User's Guide (page 8):
    http://www.ootii.com/Unity/ActorController/ACGuide.pdf

    In addition to the default ActorDriver.cs, you can find 3 other sample drivers in the drivers folder:
    Assets\ootii\ActorController\Code\Actors\CharacterControllers\Drivers

    These are pretty basic and should be good examples. There's really only 6 functions you'll care about. I talk about them on page 7.
     
  11. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    I'm looking into possible alternatives to my current character controller to fix some issues I'm having with it. The primary issue being that if a player runs up some slopes it constantly switches from falling to running and back and forth, instead of recognizing that this is somewhere the player cannot go.

    So far your asset is what I'm leaning towards as the best alternative, but I found a spot in your web demo where the same thing happens. I was wondering if you are aware of that/already fixed it?
     
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Can you send an image of where that spot is? tim@ootii.com

    I have an update to the demo scene coming because of a setting someone else found, but I'm not sure it's the same thing.
     
  13. JosephHK

    JosephHK

    Joined:
    Jan 28, 2015
    Posts:
    40
    I just dont want the ActorController to update automatically.
    So I am seeking a way to disable the automatic update of the ActorController and update the ActorController via some method call.
     
  14. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    Okay I just emailed you the image.

    Oh, as to what @JosephHK is requesting is something I'd need as well. For client prediction I have to have complete control over when the movement system runs to be able to rerun previous input.
     
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    As a character controller, it will update every frame while the component is enabled. I do logic in FixedUpdate() and LateUpdate(). You can totally disable the Actor Controller by disabling the Monobehavior. That's just Unity's standard:

    <AC variable>.enabled = false;

    Another thing you can do is check the "Use Transform" check box. That will give you complete control over moving the character using "transform.position", but then I won't do collision checks and some other AC specific logic.

    There's currently no way for you to run all the AC logic without going through the normal FixedUpdate() and LateUpdate() cycles as-is. If you modify the FixedUpdate() and LateUpdate() functions to be public, you could disable the component and try calling them directly. If that works, I can made a similar modification in a future update.

    That step is too high. So, he's trying to push up but gravity is pulling him down.

    The latest version is smoother, but the real answer is that I need to make his step height higher, make the step smaller, or remove the step from the level. That was poor level design in my demo. :(
     
  16. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    So there's nothing you can do to check that this step is too high before trying to go up it to fix the looped falling? Level design won't always be an option for my game because of different characters of different heights of different movement capabilities.
     
  17. JosephHK

    JosephHK

    Joined:
    Jan 28, 2015
    Posts:
    40
    Because I have to control the the execution order of different methods (e.g. UpdateCharacterPosRot, UpdateIKSolver, UpdateCameraPosRot), so it would be good if I can manually update the ActorController. I can modify the ActorController, but it would be troublesome as I have to modify it again whenever new update is released.
     
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I do check if steps are too high, but it's more complicated than that due to the slope.

    I explain it in the documentation (page 18):
    http://www.ootii.com/Unity/ActorController/ACGuide.pdf

    You have options to change the step height, change the body shape that pushes up onto a step that's outside of that height, and other options. However, the AC (or any other character controller) won't handle all situations all the time. Level design will to come into play at some point.
     
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    As I mentioned, if your modifications work I'll make those modifications part of the update.
     
  20. JosephHK

    JosephHK

    Joined:
    Jan 28, 2015
    Posts:
    40
    I just finished a rough modification for the manual update and it is sent to you.
    Please take a look. For the line modified and codes added, it is commented with //Modified
     
    Last edited: Jan 11, 2017
  21. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Got it. What you're doing makes sense.

    I just need to make sure I don't do anything that hurts existing users.

    Once I get some time, I'll see the best way to bring the two approaches together.
     
    JosephHK likes this.
  22. Testeria

    Testeria

    Joined:
    Aug 15, 2013
    Posts:
    18
    Hello, I have few questions if You wouldn't mind.

    1. I need better controller for 2d (2.5d) game. I imagine it would help with better control of both player and npc characters. Is it just controller or do it have some integrated animations?

    2. Can it use 2d physics?

    3. Can it use behavior Designer (Opsive) for npc movement control or would it need new driver to be written for it?

    4. Can it use Rewired as an Input source, do I need to write my own Input source to integrate Rewired - or perhaps I misunderstand whole concept? :)

    Any consideration You see with using AC for 2d game? (for now I use ferr2d with 3d colliders and meshes as player/npc but there is a lot of glitches)

    Thanks for your attention,
     
  23. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hi @Testeria

    This asset is just a character controller (no animations). With it, you would create a "driver" that gives the AC instructions like "Move" and "Rotate". Then, the AC does it, but applies, gravity, collisions, etc.

    If you're looking for animations, that would be the Motion Controller (which includes this asset).

    No. This asset is an "input based" controller. So, all movement comes from user or AI input. That said, you can simulate some forces by calling AC.ApplyForce()... however it is very basic.

    Behavior Designer can be used to control it. You'd simply check a checkbox.

    However, when the "Use Transform" checkbox is checked I won't processed collisions as I'm assuming the AI will handle that. I do this for performance reasons.

    Yes. In fact, one is already created and available on the Vault. The Vault is a place where I (and others) place free stuff.

    It will be fine for a 2.5D game.

    There's a couple of videos where I talk about this. I know others are using it that way as well. It really comes down to the driver. You can use one of my many example drivers or create your own.



    I hope that helps. :)
     
  24. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I just wanted to let you know that both the videos you have on this asset's store page say "The video does not exist" when you try to play them.
     
    Tryz likes this.
  25. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Thanks!

    I'm not sure why they would be gone, but I just re-added them. They should be up soon.
     
    kurotatsu and magique like this.
  26. Testeria

    Testeria

    Joined:
    Aug 15, 2013
    Posts:
    18
    Thanks, I bought Your component. Now I'm trying to make it work.

    Most of the things is ok, added rewired input, AC, AD like in tutorial. It works fine, except vertical controls are moving player on the z axis even when it is turned 90 deg. and should move on x axis (its 2.5d platformer). Is it possible to change somewhere (AC, Rewired) or do I need to write my own driver for that?

    ps. videos on first page of this forum still not working.
     
  27. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Exactly. The AC is a low level character controller that knows how to move, apply gravity, handle collisions, tilt, etc. However, it doesn't know when to do them.

    So, your custom driver will tell it using the Move() and Rotate() functions.

    I include several drivers (in the Driver folder and in the demos). But, for your custom movement, you'll want to create your own driver.

    This video explains it more, but I'll look for those missing videos too.

     
  28. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Hello, is there a way to know which version of AC we are using ? I imported mine a bit ago , so I'm not sure which one I'm using:p
    [EDIT]Actually I use AC from Motion Controller v2.18 , can you tell me the version of AC?
     
  29. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Sure. In the Assets\ootii\ActorController folder is a text file called Version.txt.

    When I update the AC or MC, I also update the other. So, as long as you keep the MC updated, the AC will update too.
     
  30. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Update Day!

    Today I have a pretty huge update to the Actor Controller.

    I've re-written the guts of the AC to be more responsive, smoother, and "sure-footed". You won't really notice any new features, but I did change some of the properties.

    For example:
    - Step Up/Down Speed is now a percentage. I suggest something like 0.75.
    - Force Grounding Distance is best around 0.3.

    Most of the other assets just have minor changes to support the AC. If you do have any issues, I'm always here to help!

    As always, when you update... please update all assets.
     
    FargleBargle and Seith like this.
  31. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Are there any major changes to the documentation? The version on the website is dated 9/15/2016 and the one included in Motion Controller is even older(10/21/2015).
     
  32. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    No, there's not.

    Nearly all the changes recently have been under-the-hood. I also use tool-tips in the inspector. So, hovering over a title should tell you everything you need to know.

    The one on the website is correct. I forgot to remove the one in the MC, but I will.
     
  33. BountyMouseStudios

    BountyMouseStudios

    Joined:
    Jul 11, 2013
    Posts:
    2
    I love the Actor Controller. You created something simple yet usable, but I am encountering a few oddities that I am hoping you could help me sort out:

    I set up 3 walls and a ground, forming a room with one 1 open side, for simple collision testing.
    I have a basic actor controller & driver setup. What I found is the jump height seems to be affected when I am applying force against the walls while jumping:
    • When starting a jump against a wall, keeping direct force against it the whole time, my jump height is extended. if however, I do the same thing in a corner (against 2 walls at once), the jump height is shorter.
    • Even odder, I had also created the same environment with ProBuilder and the jump would immediately stop, dropping to the ground in a matter of a few frames, but only against one wall. This may be an issue with the ProBuilder generated mesh, even if it is a simple box.
    • A persistent oddity I have found is that the controller appears to stop a bit before fully reaching the ground. Applying force against a a wall keeps it there until I release the applied directions.
    Again, this is an awesome asset, and I want to make it the foundation of my project, but it will rely on precision platforming, which this may create an issue with.

    -Thank you.
     
  34. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    Just so you know, as mentioned in another one of his threads, Tryz just left for vacation and will be back in a few more days.

    My guess is that when he gets back to a computer, he'll want to have your scene so he can try to recreate the issue you are experiencing. So you might want to experiment with it a little more, changing various settings and making further observations, and if you can't get anywhere, then make a copy of the project that is stripped of 3rd party plugins and art (things you can't share), and send it to Tryz via his support email address, along with instructions on how to reproduce the effect you're observing.

    If you can take screenshots of what's happening, that's helpful as well.
     
  35. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey @NosTurtle , I'm back from vacation and looking at some thing. I just didn't want you to think I was ignoring you. :D

    You rock! Thanks @hopeful.
     
  36. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I've fixed the "extended" issue. However, when pushing against a wall (especially multiple walls), the jump could be shorter. That's because we loose some of the velocity as it's absorbed by the impact into the wall.

    Can you send me the box you created with ProBuilder? I can try it out.

    Fixed.

    True physics simulations can get super expensive... especially with multiple collisions. So, I cheat a bit and only react to the first collision. Then, I determine the deflection and stop any movement if the deflection has a collision. This keeps the whole system fast and seems to have worked well. However, it does cause the corner issue that you mention. When you push against a corner, we get a deflection from one wall into the next. With that, I start tempering the movement to ensure we don't push into anything or ping-pong back and forth. So, you'll see the jump shortened even more when you're pushing forward and jumping in a corner. Unfortunately, there's no way around this without changing how I'm handling multiple collisions and adding a big hit to performance.

    If you want to try out the latest version, send me an email to tim@ootii.com and I'll reply with the latest ActorController.cs
     
    hopeful likes this.
  37. BountyMouseStudios

    BountyMouseStudios

    Joined:
    Jul 11, 2013
    Posts:
    2
    Ok. I just got back from work and will send you as accurate & basic of a project recreating what I described as soon as possible.
    I will also see if ProBuilder can finalize out the mesh so I can send it to you with out including ProBuilder. I have a hunch as to why but I'll explain in the email.
    Thank you so much.
     
    Tryz likes this.
  38. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Hi.

    Interesting asset. I am looking for a controller that allows to wall walk like in the tutorial video but using the Unity 5.6 navmesh agent. I am ok with creating the actual navmesh on the walls and then connecting them using the navmesh link, but having a bit of trouble of getting the model to move in between the navmesh links. The doc for Unity navmesh link suggests to code our own transition between the links so I am looking for a controller that may work out of the box.

    If you have a video for that or tutorial / doc about it somewhere it would be great so I can be informed and purchase the asset.

    My main problem seems to be that when navmesh agent comes off from the link, it slightly rotates to side ways for some unknown reasons and then heads off to the destination.
     
  39. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey castor76,

    The AC will handle Unity's standard (horizontal) nav meshes fine by using the Nav Mesh Agent. I haven't tried it with Unity's newer vertical nav meshes and I don't have any auto-traversal of off-mesh links.

    I do talk about how to force rotation of the AC to handle walk walking in this video (32:30), but that's not tied to a Nav Mesh Agent:


    What you're asking for is doable, but not doable out-of-the-box. You would have to create a custom driver that would handle the kinds of transition you want.
     
  40. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
  41. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Thanks.

    That's just with Unity's raw Nav Mesh Agent. No ootii assets are involved, right?
     
  42. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Yeah just native stuff. I was just wondering if this kind of issue can be resolved using your asset..
     
    Tryz likes this.
  43. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    Hello,

    A bit in an emergency....

    Currently using the recent Unity ARKIT but there is a major issue with the in-Build Navigation System.

    It comes from the AR flat surface detection which makes the AR "Anchor" having some scale value.
    When the scale value is too small (can be 0.1 and less...), the realtime nav mesh creation is getting super weird.

    - https://forum.unity3d.com/threads/navigation-mesh-arkit-dynamic-scale.487473/#post-3178430

    Then willing to buy your plugin right now if :

    1- possibility to create/update the nav mesh in runtime.
    2- low scale value should affect the navigation system.

    For the rest, I am sure your plugin is working very well in view of the very positive feedbacks.

    Well those issue has been mentioned in the main ARKit thread but no fix yet.
    Then many folks could be interested into your plugin if it could do what the in-build navigation system can't.

    - https://forum.unity3d.com/threads/a...nity-arkit-plugin.474385/page-21#post-3181098


    Thank you! :)
     
  44. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hi,
    I'm not super familiar with ARKit, but I do know what it is. Unfortinately, the AC really isn't a navigation tool like you are asking.

    As a character controller, it can follow a Nav Mesh Agent, but it won't create or update a Nav Mesh. It just follow the path the nav mesh agent gives

    I hope that makes sense.
     
  45. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    Oh, are you saying you are using the Unity's Navigation mesh as base?...
     
  46. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    No. The AC is an advanced low level character controller that knows how to move, rotate, slide, collide, walk on walls, etc. It's not based on any other component.

    It includes several "drivers" that give examples on how to control the AC. One of those drivers uses Unity's Nav Mesh Agent. Another driver uses player input. You could create any driver you need to control how and when the character moves.

     
  47. tgienger

    tgienger

    Joined:
    Jul 18, 2013
    Posts:
    45

    I'm not sure if this has been brought up before, I did try to search it. 2 things happening here. 1. With either the unity collision or without the character will get hung up on edges mid-jump and 2. the longer you hang there the more the AccumulatedVelocity goes up even though you're not actually falling.
     

    Attached Files:

    • GIF.gif
      GIF.gif
      File size:
      3.6 MB
      Views:
      488
  48. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    It looks like what's happening is that the bottom of one of the upper spheres is catching the step and as you continue to push forward it's keeping the sphere on the ledge.

    You could try making the body shapes a bit bigger so there's less of a gap between them as they shift. That should stop them from catching. I'm using a radius of 0.4 and not catching.



    The forward force being applied is also keeping you up. It's like pushing a ball against the wall with your hand. It won't fall because there's more horizontal force than vertical.

    I've been avoiding cancelling your forward input when you collide, but I can make that an option. It just may mean you can't push yourself on a slope while jumping/falling... which is probably ok.
     
    Last edited: Nov 11, 2017
  49. tgienger

    tgienger

    Joined:
    Jul 18, 2013
    Posts:
    45
    You don't have to put it in if you don't want. I'll be modifying the controller to suit my needs; I was just pointing it out. It didn't feel right, so I wasn't sure if it was intended.
     
    Tryz likes this.
  50. LukeDawn

    LukeDawn

    Joined:
    Nov 10, 2016
    Posts:
    403
    I've been looking at the MotionController and trying to see what I do to make it work with authoritative server networking. Took a break to suss out the ActorController; have to say it's a work of genius. As the basis for everything a server needs to do, the drop in AC is wonderfully performant and does nearly everything required.

    The only things I haven't been able to work out are sitting, laying down/getting up, and swimming. Are there any pointers to get me started on these, collider orientation wise.
     
    Last edited: Mar 3, 2018