Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

Character Controller Pro

Discussion in 'Assets and Asset Store' started by lightbug14, Jan 15, 2020.

  1. shanemt

    shanemt

    Joined:
    Mar 5, 2014
    Posts:
    21
    I came in this thread to request just this very feature!
     
    pez likes this.
  2. shanemt

    shanemt

    Joined:
    Mar 5, 2014
    Posts:
    21
    I'm still trying to figure out how to get a prone and crawling state implemented. What would it take to allow for a box collider instead of just a capsule collider?

    Also, is there anything built in to allow a specific state from going over edges? I don't want the crawling character to be able to crawl off edges.

    Edit: I guess there are a few other things making this difficult, such as rotating the character (and box collider) when prone to be flush with the incline.... hmmm...
     
    Last edited: Jan 24, 2021
  3. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    This is one of those things that are normally faked in games (the sphere trick i mentioned before), however i would like to implement a better "native" way of handling this. The best possible approach (for a dynamic RB) is using any collider shape you want (box collider, capsule collider, etc), however, this will break the rest of the features (especially for an upright capsule-based character controller).

    The issue is not only the rotation itself but the grounding process as a whole. I'm not saying this is impossible to implement, it just need to be implemented with care.

    Can you share more info about that (velocity, obstacles, anything...)? That's really weird, because the character will calculate the (almost) exact velocity in order to be next to the obstacle, whether the input velocity is 1 m/s or a 1 million m/s. This is why i ended up using discrete collision detection. In any case, you will be able to select CCD or DCD in the inspector (next version).

    EDIT:
    Ohhh, i know what's causing the issue :( -> dynamic rigidbodies (as obstacles). I think i know how to get the best of both worlds (CCD and DCD).

    Try to customize the script, for example:
    Code (CSharp):
    1. CharacterActor.Forward = CharacterStateController.MovementReferenceForward;
     
  4. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Small (big) Update!

    In 1.3.0 (next update), the character will be compatible with any type of moving/rotating ground (animated, scripted, kinematic and dynamic). This basically means, no matter how the ground moves, if it moves then the character will follow it perfectly. See the video:

    https://twitter.com/Lightbug4/status/1355199734449922052

    BTW, i have Twitter now :D (better late than never). I will be posting small updates, new features and experimental stuff.
     
    filod, Broudy001, pez and 1 other person like this.
  5. Broudy001

    Broudy001

    Joined:
    Feb 12, 2020
    Posts:
    33
    Just need a Discord server for me to annoy you on :p
     
    lightbug14 likes this.
  6. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    :D Yeah i promised a discord server a few days back, I was getting this error "X email is already registered" :mad:, it seems like i used my email address before (?) ... so i created a new one just for this, i'm super smart.

    See if this works:
    https://discord.gg/2PG42zYqQ7
     
    Broudy001 likes this.
  7. shanemt

    shanemt

    Joined:
    Mar 5, 2014
    Posts:
    21
    Question... I'm looking to expand on ledge hanging. Is there a good way of projecting a surrogate of the player to a specific position to determine "would the character be stable grounded here?"
     
  8. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Yes, in order to do that you need to:
    1. Get the destination Vector3 (feet position <-> transform.position). You can get this value by doing some basic math with the left and right ray (form ledge hanging):
    Code (CSharp):
    1. Vector3 destination = 0.5f * ( leftHitInfo.point + rightHitInfo.point );
    2. Checking for collisions (using the destination value). You can use the CharacterActor PhysicsComponent component just for this (see how the DetectLedge method does this using a raycast). OverlapCapsule is perfect for this:

    Code (CSharp):
    1. bool allowedToClimb = !CharacterActor.PhysicsComponent.OverlapCapsule(
    2.             CharacterActor.GetBottomCenter( destination ) ,
    3.             CharacterActor.GetTopCenter( destination ) ,
    4.             CharacterActor.BodySize.x / 2f ,          
    5.             ledgeHitInfoFilter
    6.         );
    Let me know if this works (there might be some issues, i'm testing this in 1.3.0). This should work with 2D as well.

    I will expose all the internal collisions functions in 1.3.0, so you'll be able to use that instead (a few less arguments). Also, i will include this little overlap for the next version, thanks for pointing this out.
     
  9. carmofin

    carmofin

    Joined:
    May 13, 2017
    Posts:
    56
    Hi!
    I have managed to disable jumping on collision.
    Now I want to do something similar with running. How can I disable the run function? Planarmovement doesnt seem to have a corresponding parameter!
     
  10. pez

    pez

    Joined:
    Jul 6, 2013
    Posts:
    37
    Hi,

    I'm just setting up the wall slide state & was wandering if there was a way I could control the length of time from jumping from a wall slide before player direction input redirects momentum?

    Here's a video example - I kinda want it to act a bit like a dash so you can go from wall to wall without needing to adjust direction input.

    Thanks
     
  11. carmofin

    carmofin

    Joined:
    May 13, 2017
    Posts:
    56
    Hi!
    I'm noticing another issue: When my character steps on a collision box, no collision event is triggered.
    Only once he jumps the collision starts...
    Is this a bug, wanted behaviour and what can I do about it? (I'm also still hoping for an answer on the issue why a disabled platform teleports my player half across the map and how to prevent it)
     
  12. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Check NormalMovement.cs, in there you have exactly how everything works. Once the "run" action is active the "wantToRun" flag is enabled.This changes the target velocity value for the MoveTowards function.

    By default the momentum you get is based only on the acceleration/deceleration parameters from NormalMovement. I understand what you want to achieve, at this point you'll have to modify NormalMovement in some way (because what you want is not there). One thing you can do is modify the acceleration factor based on the vertical velocity:
    - if( verticalVelocity.magnitude < someThreshold ) --> acceleration is A (!= 0)
    - if( verticalVelocity.magnitude > someThreshold ) --> 0

    Check ProcessPlanarMovement method
    Code (CSharp):
    1. protected virtual void ProcessPlanarMovement( float dt )
    2. {
    3.         SetMotionValues();  //<--- Check this
    4.  
    5.         ...
    6.  
    7. }
    You don't need to use a simple if statement, you can make an AnimationCurve curve(for acceleration/deceleration), a math function, etc.

    This is something a user is actually using for his game. I'll probably add this feature, it seems quite useful.


    No bug, the capsule uses an offset (bottom to top) in order to easily step over objects, project its velocity, and prevent annoying contact offset related issues while probing the ground.
    I would always recommend to use the character information first (if possible), especially in situations like these, related to the "grounding" of the character (so much going on). When the character tells you "I'm contacting the ground" that effectively means that the character is doing that, not the collider (which is just one part of it).

    In other words, the grounding is usually handled by the code, the rest (wall/head collision) is handled by the physics.
     
  13. pez

    pez

    Joined:
    Jul 6, 2013
    Posts:
    37
    I don't think vertical velocity is what it should be based off to be honest? I'd still want the same freedom of control I have with normal jumping from ground etc. It's just from wall jumping where I'd want it to be more locked in to a direction for 0.25 seconds or something.
     
    Last edited: Feb 10, 2021
  14. pez

    pez

    Joined:
    Jul 6, 2013
    Posts:
    37
    I might have missed that I can just adjust the acceleration on Not Grounded Movement only so normal jumping wouldn't be affected. I was going to look into this but unfortunately I can't get or set the different Movement parameters in playmaker :(

    Unless they're referenced from a different script?

     
  15. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    I don't know what version are you using right now... from 1.1.5 most of the demo states properties are public.
    Code (CSharp):
    1. [CustomClassDrawer]
    2. public PlanarMovementProperties stableMovement = new PlanarMovementProperties( 50f , 40f );
    3.  
    4. [CustomClassDrawer]
    5. public PlanarMovementProperties unstableGroundedMovement = new PlanarMovementProperties( 10f , 2f );
    6.  
    7. [CustomClassDrawer]
    8. public PlanarMovementProperties notGroundedMovement = new PlanarMovementProperties( 10f , 5f );
    9.  
    If not, just replace "[SerializeField]" with a "public".

    Acceleration and deceleration (inside PlanarMovementProperties) are public as well.
     
  16. pez

    pez

    Joined:
    Jul 6, 2013
    Posts:
    37
    I'm on version 1.2.2 and they're all listed as public in the script, just don't show up in playmaker for some reason beyond my knowledge!
     
  17. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Oh, no idea what's going on. Is it possible playmaker is not being able to access plain C# classes?
     
  18. pez

    pez

    Joined:
    Jul 6, 2013
    Posts:
    37
    I was just looking into it & I don't think it can access variables within structs maybe.
     
  19. carmofin

    carmofin

    Joined:
    May 13, 2017
    Posts:
    56
    How to I disable the run-function in a clean way. That means, without having to rewrite NormalMovement, again.


    In games you want the character to be able to step on pads, teleports, buttons, whatnot...
    Without a collider I dont even know what I'm stepping on...
    I have no idea how to handle this and consider this broken.
     
  20. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    There is no way to do that without writing anything. You could bypass the wantToRun flag in some way.
    I've included a canRun boolean inside planarMovementParameters.

    Code (CSharp):
    1. [System.Serializable]
    2. public class PlanarMovementParameters
    3. {
    4.  
    5.     ...
    6.     public bool canRun = true;
    7.  
    8.     ...
    9.  
    10. }
    11.  
    and then use it like this:
    Code (CSharp):
    1. if( wantToCrouch || !planarMovementParameters.canRun )
    2.         wantToRun = false;

    Enabling/disabling a particular action (directly) would be very cool as well (i'm writing this down), although this would have also required some extra code to be added.

    You have like 10 or 12 properties inside the actor dedicated to tell you something about the ground.

    Like i said before, that's is not a bug, it is a design choice (in fact a very well known technique for character controllers).
    The problem here is that you are assuming how some things work based on experience (own projects, tutorials, pre-defined concepts, etc), always think in terms of the character. Rigidbody? forget about it, Collider? forget about it. Example:
    Code (CSharp):
    1.  
    2. // This doesn't work
    3. CharacterActor.GetComponent<Rigidbody>().AddForce( someForce );
    4.  
    5. // This does work
    6. CharacterActor.RigidbodyComponent.AddForce( someForce );
    It is still possible to use the associated collider/rigidbody components directly (of course), just don't expect everything is going to work just like that.

    In order to detect an "area" a produce some action you can:
    - use the character: check if the ground is an "area" and then do the action.
    - use that "area" itself (OnTrigger): Detect characters nearby (OnTriggerEnter/Stay for example) and if the 'character ground == area' then do the action (also you can put the trigger on the same action area).
     
    Last edited: Feb 11, 2021
  21. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Really? Well, i guess the only way to do that is by extracting all those internal fields from NormalMovementExtras.cs into NormalMovement.cs
    Example:
    This...
    Code (CSharp):
    1. // NormalMovementExtras.cs
    2. public class PlainCSharpClass
    3. {
    4.           public bool someVar;  //<----
    5. }
    6.  
    7. // NormalMovement.cs
    8. ...
    9. if( plainCSharpClass.someVar == true )
    10. {
    11.       //...
    12. }
    13.  
    14. ...
    ...Into this...
    Code (CSharp):
    1. // NormalMovementExtras.cs
    2. public class PlainCSharpClass
    3. {
    4.           // public bool someVar;  //<----
    5. }
    6.  
    7. // NormalMovement.cs
    8.  
    9. bool someVar;
    10. ...
    11. if( someVar == true )
    12. {
    13.       //...
    14. }
    15.  
    16. ...
     
  22. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Small update:
    For 1.3.0 characters will be able to use/ignore the velocity of the ground as their own velocity. There will be available some threshold values to configure, one for transferring grounded->not grounded velocity (a.k.a jumping on a platform), and one for grounded->grounded (basically for just being on top of a platform).
    Here is a video:
     
    docsavage, Bartolomeus755 and pez like this.
  23. pez

    pez

    Joined:
    Jul 6, 2013
    Posts:
    37
    I can't figure it out to be honest. I've tried creating public float values in NormalMovement to act as acceleration/deceleration on notGroundedMovement, but everything is tied into that planarMovementParameters struct that I can't just insert new floats into it. Not in a way I know how to do it anyway.



    & completely removing the struct and creating new variables for all movement types of acceleration/deceleration - I still have no idea how I'd go about changing this "currentMotion" to be using my variables when it seems like something that needs to be referencing a struct?



    Lot of headache for just wanting to change the value of not grounded acceleration based on if it's a normal jump or a wall jump.
     
  24. carmofin

    carmofin

    Joined:
    May 13, 2017
    Posts:
    56
    In case anyone else wants to block the running action, you just got to modify ProcessPlanarMovement, on the else to crouched:

    Code (CSharp):
    1. public bool blockrun = false;
    2.  
    3. currentPlanarSpeedLimit = wantToRun && !blockrun ? planarMovementParameters.boostSpeedLimit : planarMovementParameters.baseSpeedLimit;  
     
  25. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Yes, that's the idea of the struct. It works like this:
    1. Get the character state (stable grounded, not grounded or stable).
    2. Based on 1 it set the struct value
    3. The rest of the script uses that struct (instead of asking "is stable? then use this... if not, then use that"

    At the end what matters is this simple method:
    Code (CSharp):
    1. CharacterActor.PlanarVelocity = Vector3.MoveTowards(
    2.                     CharacterActor.PlanarVelocity ,
    3.                     currentPlanarSpeedLimit * CharacterStateController.InputMovementReference * speedMultiplier ,
    4.                     ( needToAccelerate ? [B]currentMotion.acceleration[/B] : [B]currentMotion.deceleration[/B] ) * dt
    5.                 );

    Try to extract the entirePlanarMovementProperties struct. See if Playmaker can read that or not (that would be much more easy i think).
     
  26. pez

    pez

    Joined:
    Jul 6, 2013
    Posts:
    37
    Playmaker can read things not in a struct fine. The issue is I don't know how to extract an entire struct and re-write the movement code (I'm using playmaker for a reason).

    & even if I randomly had the code pasted to me with the exact solution - that basically means I can't ever get updates of the asset because it'd overwrite this needed change.

    I asked in the playmaker forums & they basically said that it has to be supported by the author of the scripts, for me to get and set variables in structs.

    This seems like the sort of asset a lot of predominantly art based developers would get to use alongside visual scripting, so might be worth considering supporting it.
     
  27. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Leaving your custom/modified code inside CCP's main folder is like putting important files inside the recycle bin. Like you said (in other words), a new update requires deleting everything and re-importing.

    1. Those acceleration and deceleration fields need to be outside the struct (but inside the class):
    Code (CSharp):
    1. ...
    2. // These structures are used by "SetMotionValues"
    3. [CustomClassDrawer]
    4. public PlanarMovementProperties stableMovement = new PlanarMovementProperties( 50f , 40f );
    5.  
    6. [CustomClassDrawer]
    7. public PlanarMovementProperties unstableGroundedMovement = new PlanarMovementProperties( 10f , 2f );
    8.  
    9. [CustomClassDrawer]
    10. public PlanarMovementProperties notGroundedMovement = new PlanarMovementProperties( 10f , 5f );
    11. ...
    12.  
    to this:
    Code (CSharp):
    1. ...
    2. [Header("Stable grounded parameters")]
    3. public float stableGroundedAcceleration = 50f;
    4. public float stableGroundedDeceleration = 40f;
    5.  
    6. [Header("Unstable grounded parameters")]
    7. public float unstableGroundedAcceleration = 10f;
    8. public float unstableGroundedDeceleration = 2f;
    9.  
    10. [Header("Not grounded parameters")]
    11. public float notGroundedAcceleration = 10f;
    12. public float notGroundedDeceleration = 2f;
    13.  
    14. ...
    15.  
    2. NormalMovement needs to use that data, go toSetMotionValues, and change this:

    Code (CSharp):
    1. void SetMotionValues()
    2. {
    3.         // This is a more clean/organized version of the 'if' statements from before        
    4.         switch( CharacterActor.CurrentState )
    5.         {
    6.             case CharacterActorState.StableGrounded:
    7.                 currentMotion = planarMovementParameters.stableMovement;
    8.                 break;
    9.             case CharacterActorState.UnstableGrounded:
    10.                 currentMotion = planarMovementParameters.unstableGroundedMovement;
    11.                 break;
    12.             case CharacterActorState.NotGrounded:
    13.                 currentMotion = planarMovementParameters.notGroundedMovement;
    14.                 break;
    15.  
    16.         }    
    17.  
    18.        //Materials
    19.        ...
    20.  
    21. }
    22.  
    to this:

    Code (CSharp):
    1. void SetMotionValues()
    2. {
    3.         // This is a more clean/organized version of the 'if' statements from before
    4.         switch( CharacterActor.CurrentState )
    5.         {
    6.             case CharacterActorState.StableGrounded:
    7.                 currentMotion.acceleration = planarMovementParameters.stableGroundedAcceleration;
    8.                 currentMotion.deceleration = planarMovementParameters.stableGroundedAcceleration;
    9.                 break;
    10.             case CharacterActorState.UnstableGrounded:              
    11.                 currentMotion.acceleration = planarMovementParameters.unstableGroundedAcceleration;
    12.                 currentMotion.deceleration = planarMovementParameters.unstableGroundedDeceleration;
    13.                 break;
    14.             case CharacterActorState.NotGrounded:              
    15.                 currentMotion.acceleration = planarMovementParameters.notGroundedAcceleration;
    16.                 currentMotion.deceleration = planarMovementParameters.notGroundedAcceleration;
    17.                 break;
    18.  
    19.         }    
    20.  
    21.        //Materials
    22.        ...
    23.  
    24. }
    25.  
    As you can see, with only two simple floats the code size increased by two (what was done in one line now requires two).


    If you can ask them for a clear example step by step, because what i think is a "custom action" may not be what we want. My guess (i didn't read the entire documentation) is that i need to create a custom action for NormalMovement (or even for PlanarMovementParameters) that sets/gets the values from inside the class for you, so you don't need to interact with the struct directly.

    If supporting this asset is "free" (from the code POV) then i'll do it. What i mean by "free"? No specific Playmaker's API involved, obviously i don't want to mix my own content with someone else's content.
     
  28. pez

    pez

    Joined:
    Jul 6, 2013
    Posts:
    37
    Thanks, I'll try out this code change later.

    Yes I think it is basically just creating custom actions that can handle certain parameters within the code. Other assets I've used that support it have their own set of actions.

    I think by the sounds of it you might need the API, but just for the custom actions. If you wanted it not to be mixed in with the controller asset I've seen other assets list playmaker action addons as their own package too. Some aren't even made by the author of the package like the doTween one
     
  29. TooManyPotatoes

    TooManyPotatoes

    Joined:
    Apr 11, 2014
    Posts:
    6
    Do you believe that this update will fix some of the sliding I have run into when having the character stand atop a moving dynamic rigidbody as shown in the gif below?

    https://imgur.com/hZQH671


    Thanks again for developing this awesome package!
     
  30. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Hi,
    Yes, absolutely, the character won't move an inch from the reference position.

    I would like to know how that platform/ship is moving. I'm assuming you are using a normal rigidbody using forces/velocity (?), and not a RigidbodyComponent component from CCP. I say this because i've tested dynamic platforms before and the results were much better.
    See this (from 1.2.2): https://drive.google.com/file/d/1XOtiNYm0gJ92nLyzc4jS7tUFZfgVpn8S/view


    Thanks for the kind words!
     
  31. NarryG

    NarryG

    Joined:
    Mar 11, 2020
    Posts:
    9
    What's the viability of making this work with Unity PhysicsScenes. I tried swapping out all the hits in PhysicsComponent3D to limited success. The actual core controller works, but components such as standing on a spinning platform don't work and if you fidget around too much, it starts to glitch out.


    Edit: Never mind. After moving the physics simulation pump to the end of my execution order, it seems to work perfectly.
     
    Last edited: Feb 22, 2021
  32. SimplyNew

    SimplyNew

    Joined:
    Jul 21, 2020
    Posts:
    9
    Hi @lightbug,

    Can you please share when you are planning to release 1.3?

    Thanks
     
  33. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Hi, i've just uploaded version 1.3.0 to the store :) hopefully it will be available this week (tomorrow? friday?).

    Probably the most important stuff:
    - Custom interpolation, now i'm in charge of how (character) transforms move and rotate. Unity just don't want to unify this behaviour for 2D and 3D... it is a mess.
    - Moving platforms now work perfectly fine, no matter if it is kinematic, dynamic, scripted or animated.
    - One way platforms for 2D and 3D.
    - Domain reload related fixes, basically you'll be able to re-compile the scripts while in play mode,and everything should be working fine.
    - a new "ZeroGravity" state, basically the character is a "not grounded" character moving around, but also can rotate using yaw, pitch and roll (also two new Float actions were added, "pitch" and "roll" ).
    - Improvements in general: physics interactions, properties, rotation, states, etc.
    - I've also added a custom define associated with Unity's Terrain module (assembly definition file). Now CCP will able to ignore the internall terrain stuff if this module is not present in your project.
    - Bugs!
     
    Broudy001 likes this.
  34. Broudy001

    Broudy001

    Joined:
    Feb 12, 2020
    Posts:
    33
    I tried updating to 1.3, but I now get an error in the InputSystemHandler Script. NullReferenceException on the GetFloat function.

    I'm using the new Input System.

    Tried removing the Brain and Input scripts from the game object and re-adding, same problem. Haven't changed anything else.

    Also had to add the Input System to the core.lightbug.character-controller-pro assembly
     
  35. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Oh yes, that's because of the input action asset. Wow it is already online?! I didn't even update the demos yet :( .
    Give me a couple of hours and i'll upload a new input action asset (to the docs). If you don't want to wait you can add these two new actions (value + axis..similar to "Horizontal" and "Vertical") yourself:
    - "pitch" q e
    - "roll" r t

    The asmdef reference must be added everytime (for now, this is the last version that supports the old system by default), unity doesn't allow me to add one without the system installed (manually). I had some trouble with this missing reference in the past, this is noticeable if you don't have the new system installed (probably 80% of the users).


    EDIT ---------------------------------

    The input action asset has been updated, download it from here (link from the docs):
    https://firebasestorage.googleapis.com/v0/b/gitbook-28427.appspot.com/o/assets/-LvxVSjyzvP6F7c9h_Hu/-MUOPiqLkxCtqd033ZPs/-MH1gFeRXlp7rtJBSQ4Z/CharacterActions.rar?alt=media&token=411c255f-ed25-4055-96c7-b4298e6641e5
     
    Last edited: Feb 25, 2021
    Broudy001 likes this.
  36. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    658
    There's been an update to the asset store but I can't see any release changes as the website is stuck at 2.2 or something and the asset store page says 3.0 please see website.
    This is an annoying loop lol.
     
  37. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Yeah, that happened because the asset store accepted 1.3.0 super fast (an hour after i uploaded the package). I'll update the release notes soon.
     
    Broudy001 likes this.
  38. Broudy001

    Broudy001

    Joined:
    Feb 12, 2020
    Posts:
    33
    Nice thanks, I'll give it a crack later today
     
    lightbug14 likes this.
  39. shanemt

    shanemt

    Joined:
    Mar 5, 2014
    Posts:
    21
    The new zero grav scene is cool, but I definitely feel like the pitch should be controlled by the camera, while the roll should be controlled by Q,E. Still, seems like it could be used for a cool underwater swimming mechanic with a few tweaks.
     
    lightbug14 and Broudy001 like this.
  40. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    I agree, i was about to do that (an hour before uploading the package) but i remember that the camera also needs to know about this change, because changing the pitch of the character does rotate the camera as well. This could have been possible by just ignoring this pitch rotation in the first place (camera script), however, i didn't want to introduce new bugs :D.
    I'll implement that, "pitch" and "yaw" will be controlled by the camera, "roll" will be controlled by actions.
     
  41. Broudy001

    Broudy001

    Joined:
    Feb 12, 2020
    Posts:
    33
    Done some more testing with 1.3, most things seem to work well, but when I walk onto a dynamic/moving platform, my character stops moving, they just stay stationary on the platform as it moves, input still works as the animation for different movement still plays, but I can move at all. I put some vids in the discord.

    Was working fine in 1.2
     
  42. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Hi, i'll upload 1.3.1 in a couple of hours.

    Issues:
    - The character (root motion enabled) wasn't able to move and rotate while being on top of a moving platform.
    - root motion rotation wasn't applied as expected





    Thanks for the help Broudy!
     
    Broudy001 likes this.
  43. SimplyNew

    SimplyNew

    Joined:
    Jul 21, 2020
    Posts:
    9
    Hi @lightbug14,

    I upgraded to 1.3 and most of the things work fine. However, I am seeing massive character jitters when framerate is capped at 30fps (for mobile). This was working just fine in 1.2 even in very low-end device.

    After investigation, I found that new Interpolator.cs was causing this issue. I removed it for testing purpose and it improved performance little bit. But, it's still not perfect.

    Please, let me know if you know any fix for this issue. For my 2D Platformer game, this issue is very major issue.

    Thanks.
     
  44. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Hi, it seems you are right, the jitter is caused by the Interpolator component. This happens due to subsequent FixedUpdate calls (too many in comparison with Update calls).
    I'm working on this now, don't worry it should be relatively easy to fix (execution order of things).
    Thanks for letting me know!

    "Interpolator" is just a Monobehaviour that sets the Transform component in each Update, that's all it does. I compared my own custom interpolation vs Unity's (using CCP's Performance scene) and i was getting roughly the same result. Of course there is some small overhead involved (a new Monobehaviour, Update calls, FIxedUpdate calls, etc), but nothing more than that.
     
  45. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Well, it seems to be fixed now :)

    The "jitter" was caused by a conflict between rigidbody position and transform position, this is why if the framerate was too low the character slowed down a lot. Visually this was awful.


    All the interpolation related stuff have been integrated inside the character actor (PhysicsActor component). I tested this using 10 fps and everything works as expected :cool:. There is one small thing i need to fix (related to actions), but after that i'll upload the new version.
    The demo scenes will include a little frame rate menu on the right, in case someone want to test the character at different frame rates.
    upload_2021-3-4_3-1-46.png
     
    Last edited: Mar 4, 2021
    samanabo and Broudy001 like this.
  46. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Hello people! :) Guess what, Unity introduced a fresh and horrible bug to our lives... yay! :rolleyes:

    The bug:
    The package manager always downloads an old version of X asset, it doesn't matter which one (i believe all the assets are f*cked at this point).

    The fix (by Unity):
    The following versions (and higher) are good:
    - 2021.1.0b3
    - 2020.2.3f1
    - 2019.4.19f1


    Remember to refresh the whole list!
    upload_2021-3-5_4-50-9.png

    The fix (manual):
    In case you are not using some of the above versions (or higher), all you need to do is:
    1. Go to C:/Users/***your-user-name***/AppData/Roaming/Unity/Asset Store-5.x/
    2. Find the publisher (/Lightbug/)
    3. Delete "Character Controller Pro.unitypackage"
    4. Go to the package manager and download the asset again.


    Hope it helps
     
    Broudy001 likes this.
  47. SimplyNew

    SimplyNew

    Joined:
    Jul 21, 2020
    Posts:
    9
    Thanks for looking into this issue and fix. I appreciate it.

    That package manager bug did affect me when I migrated to 1.3. After upgrade, I was surprise to see no changes in the package. I also performed those steps to retrieve updated version. Thanks for more info on that.
     
    lightbug14 likes this.
  48. bunnybreaker

    bunnybreaker

    Joined:
    Dec 10, 2013
    Posts:
    12
    Just updating to 1.3.1 now. I had jittering, after updating from 1.2.2 to 1.3.0 which I *mostly* fixed by preventing the Interpolator from being added. It's "fixed" for now, by disabling 'Interpolate' actor. The demo scenes work fine with that set to on, so it must be something I'm doing to cause a conflict with CCP itself I guess.

    Could I request some more properties and methods be made public/protected/virtual/etc., as it makes it easier to inherit from your existing states.

    The ones I've changed thus far:
    WallSlide - CheckCenterRay()
    NormalMovementExtras - jumpSpeed
    ZeroGravity - targetUp,
    Dash - ResetDash()
     
  49. carmofin

    carmofin

    Joined:
    May 13, 2017
    Posts:
    56
    So for the first time I set up a character myself rather then copy pasting one form the example.
    I have this problem: The character just wont rotate, always looks one way, no matter how he walks.
    I've been looking through all the settings, but I cant find whats causing this... Any ideas?

    Edit: Have to turn off external reference.
     
    Last edited: Mar 10, 2021
  50. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    292
    Yeah sure.

    This happens because followExternalReference is initialized as true, so every time you instantiate that class (by adding the component) this boolean variable is true in the inspector.

    public bool followExternalReference = true; // < 1.3.1
    public bool followExternalReference = false; // >= 1.3.2
     
unityunity