Search Unity

[RELEASED] Easy Character Movement 2

Discussion in 'Assets and Asset Store' started by Krull, May 5, 2021.

  1. Pixelith

    Pixelith

    Joined:
    Jun 24, 2014
    Posts:
    578
    T̶h̶i̶s̶ ̶i̶s̶ ̶g̶o̶i̶n̶g̶ ̶t̶o̶ ̶s̶e̶e̶m̶ ̶a̶ ̶l̶i̶t̶t̶l̶e̶ ̶w̶e̶i̶r̶d̶,̶ ̶b̶u̶t̶ ̶I̶ ̶h̶a̶v̶e̶ ̶a̶ ̶t̶r̶a̶n̶s̶f̶o̶r̶m̶i̶n̶g̶ ̶t̶y̶p̶e̶ ̶c̶h̶a̶r̶a̶c̶t̶e̶r̶.̶ ̶H̶o̶w̶ ̶w̶o̶u̶l̶d̶ ̶I̶ ̶g̶o̶ ̶a̶b̶o̶u̶t̶ ̶i̶n̶t̶e̶g̶r̶a̶t̶i̶n̶g̶ ̶a̶n̶o̶t̶h̶e̶r̶ ̶m̶o̶v̶e̶m̶e̶n̶t̶ ̶t̶y̶p̶e̶ ̶i̶n̶t̶o̶ ̶t̶h̶e̶ ̶c̶o̶n̶t̶r̶o̶l̶l̶e̶r̶?̶ ̶ ̶F̶o̶r̶ ̶i̶n̶s̶t̶a̶n̶c̶e̶,̶ ̶a̶i̶r̶c̶r̶a̶f̶t̶,̶ ̶m̶o̶t̶o̶r̶ ̶v̶e̶h̶i̶c̶l̶e̶,̶ ̶d̶r̶a̶g̶o̶n̶,̶ ̶e̶t̶c̶.̶ ̶ ̶I̶'̶m̶ ̶a̶s̶s̶u̶m̶i̶n̶g̶ ̶I̶ ̶c̶a̶n̶ ̶i̶n̶t̶e̶g̶r̶a̶t̶e̶ ̶c̶u̶s̶t̶o̶m̶ ̶m̶o̶v̶e̶m̶e̶n̶t̶ ̶c̶o̶d̶e̶ ̶t̶o̶ ̶s̶o̶m̶e̶ ̶e̶x̶t̶e̶n̶t̶ ̶w̶i̶t̶h̶o̶u̶t̶ ̶i̶t̶ ̶b̶r̶e̶a̶k̶i̶n̶g̶ ̶E̶C̶M̶2̶ ̶b̶u̶t̶ ̶I̶'̶m̶ ̶a̶ ̶l̶i̶t̶t̶l̶e̶ ̶l̶o̶s̶t̶ ̶o̶n̶ ̶w̶h̶e̶r̶e̶ ̶t̶o̶ ̶d̶o̶ ̶t̶h̶i̶s̶.̶

    I've changed the settings around a bit and found a good balance of turning and movement that resembles a kinda arcade style car movement. So my problem has essentially been solved.
     
    Last edited: Oct 14, 2021
    Krull likes this.
  2. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    I really like the perch behaviour, but it only works for walking off a ledge, not while jumping onto it.

    Thanks for the information. Disappointing that there's no way to make this better, but I'll do what I can to work around the limitation.
     
  3. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Mmm, well the perch behavior definitely should work when jumping / landing.

    For example in your bottom GIF, if you set the pechOffset to its max value (your character's capsule radius), when your char jumps and lands on the higher platform it should perch up there as the horizontal distance from the character's position (capsule bottom point) to the landed point is less than given perchOffset (your capsule radius).

    Now when a character is leaving a 'ledge' (eg: its velocity points away from ledge direction), it will test the same horizontal distance but now to the unperchOffset to determine if the character should fall (unperch).

    Yes, as commented the only real solution available at this moment is to sweep a box volume but not supported in ECM since first release (I think) but on that version ECM was a very basic controller, and was removed due to some issues with steps.

    Having said that, and without giving false promises, I will explore the possibility to bring it back to newer ECM / ECM2 versions.

    Regards,
    Krull
     
  4. dotmeep

    dotmeep

    Joined:
    Apr 14, 2021
    Posts:
    7
    My character is being moved by enemy Rigidbody, even though I have not checked impart external velocity...any idea why this is happening? I messed with Mass, etc., nothing seems to change it. Note I cannot move the enemy, because it is set to Kinematic.

     
  5. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    A kinematic object isn't using physics but your character will still be pushed back by overlapping. It's no different than if you manually move a wall or a cube towards the player. The player will be shoved out.
     
    Krull likes this.
  6. dotmeep

    dotmeep

    Joined:
    Apr 14, 2021
    Posts:
    7
    Thanks for the help. I removed the rigidbody altogether from the enemy, and it still pushes my character. Isn't there a way to ensure the character stays put?

    Edit: I was able to resolve this by making the enemy non-kinematic and giving it a drag of 10, although I'm not entirely sure why this works.
     
    Last edited: Oct 15, 2021
  7. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Yes, when a kinematic rigidbody collides with a dynamic rigidbody the dynamic rigidbody will be pushed aways as the kinematic will behave like an infinite mass object, while a kinematic vs kinematic cause no push at all.

    And this lead me to following comment:

    As previously commented I am working on a major update for ECM2 (and possible ECM) as my goal is both packages shares a common character controller (in ECM referred as CharacterMovement component) so ECM2 will be a higher level product while ECM will be more to the metal / lower level version but both sharing the same character controller / motor.

    The good news is this new motor (newer CharacterMovement version) is basically complete and the biggest change is it is now FULLY KINEMATIC and first class FULLY TRANSPARENT (no special setup) support for dynamic / kinematic platforms out of the box without you having to extend PlatformMovement or anything.

    For example, you can jump on top of a dynamic vehicle (eg: Eddy vehicle), and your character will stand and be moved with it without any special treatment, the same for animated, tweened, scripted (you name it) platforms.

    Also its more performant, greater simplified, eliminated the need to implement callbacks (reduced and optional), and many more improvements.

    As it is fully kinematic to move a character (update its position) you simply call the CharacterMovement.Move method with a given velocity, and it will perform fully collision constrained movement, ground detection, platform management, dynamic collisions, events, etc automatically for you and returns the updated velocity.

    I do plan to disclose the full features and some videos soon, as actually the ECM2 integration still is in development trying to make it the more transparent possible for current users.

    Now back to your question

    This works, because these kinds of collisions are 'intercepted' by ECM and managed, so your character is responsible for computing and applying the collision resolve impulses between your character and the other character (enemy, NPC).

    Kind regards,
    Krull
     
  8. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    ecm-jumpup.gif

    I added the perch behaviour but this was the best result I could get. It still focuses on the collision point of the capsule. There is no option to raise the character to floor height.

    ecm-fall.gif

    This is what happens when I set the unperch value. I remember ECM1 having a cylinder bottom collider for unperch behaviour. Is that no longer the case? This was my favourite thing about it.


    Is current perching exposed in the API? I really want to address these situaitons in code, but there doesn't seem to be anything.
     
  9. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Hi @dock,

    ECM2 currently do not have the 'cylinder bottom feature' as as you commented for that to works character have to be on top for it to actually do something, and would not prevent the character to 'enter' ledge as the sweep test is a capsule, however if needed / wanted I could add it to upcoming major update.

    ECM2 now let you decide the perch and unperch radius, so for example in your top GIF (Perch behavior), that would be the behavior for a perchOffset = 0.5f (e.g. default character capsule radius) so the character will land (perch) in there pretty easy.

    While you can use the unperchOffset, to force the character to un-perch so he easily leaves the 'ledge' (un-perch), for example in your bottom GIF (UnPerch behavior), if your set the unperchOffset = 0.0f, your character will fall down as soon as it position crosses the ledge border (its horizontal distance is greater than unperchOffset).

    Cheers,
    Krull
     
  10. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    @Krull Thanks for the info!

    upload_2021-10-19_9-32-39.png
    Is it possible to introduce a vertical offset for the character mesh based on the current perch distance?

    It's mostly a matter of it feeling less spongy It would also be useful if the current perch was exposed in the code, so devs could add 'edge of ledge' animation treatments or other features.
     
  11. t-m-jelinek

    t-m-jelinek

    Joined:
    Jul 7, 2013
    Posts:
    1
    Hi @Krull and tx for your awesome work :)) May I ask how to enable climbing ladders? I am trying but even the given example scene is not working :/
     
  12. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Any ETA on the update? Super excited about it! I know your busy tho!
     
  13. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Hi @dock

    Mmm, no without modifying core CharacterMovement, however you can move a root pivot and parent your model to this root pivot, basically the vertical offset is the vertical distance from ground hit point and your character's current position.

    Thank you for suggestion, and yes actually it its obviously internally computed but not exposed (LedgeHit), so I will expose it as part of next update.
     
    dock likes this.
  14. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Hi @t-m-jelinek,

    Please make sure you have correctly installed ECM2 package, as the included ladders example works fine, however be aware to climb the ladders you need to press E key, is not automatically.
     
  15. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Hi @jimmygladfelter

    Well as commented the new kinematic motor (CharacterMovement) is completed, however still working on ECM2 package integration and perform tests upon integration to ensure theres not hidden bugs.

    I am aiming to mid november release if all goes well :)
     
    jimmygladfelter likes this.
  16. RSolids

    RSolids

    Joined:
    May 19, 2021
    Posts:
    22
    Hello, I've been trying to search the forum and docs, but I don't think I'm searching for the correct words.

    I'd like to know the best way to "turn off" EMC2 character controller? My goal was to implement driving around in a vehicle. I disable the CharacterMovement and Character upon "entering" the vehicle. That worked okay. Obviously, it just leaves the character standing around while the vehicle is driving around.

    So, I parented the character to the vehicle. That did not work out well at all--the character just floated upwards. So, I'm assuming it has to do with multiple rigid bodies.

    I guess, I'm at the point where I could just totally disable/deactivate the whole game object where ECM2 is and have a second "dummy" mesh that sits in the vehicle. Maybe that's the standard way of doing thing. I have no idea.

    I just thought I would ask if anyone had any ideas! :)
     
  17. RSolids

    RSolids

    Joined:
    May 19, 2021
    Posts:
    22
    Hello,

    Just following up.

    My current solution is to disable my CustomCharacter and the CharacterMovement components. Then Destroy the Rigidbody of the Character. Then I can parent the CustomCharacter GameObject to another object (the vehicle).

    When moving the CustomCharacter back into the world (out from the vehicle), I recreate the Rigidbody on the CustomCharacter GameObject. Then reenable the CustomCharacter and CharacterMovement components.

    The only problem is since Character has a reference to CharacterMovement directly (rather than an interface or something) I could not (for now) make a custom CharacterMovement and override the OnOnEnable to call InitRigidbody() OnEnable.

    I do have a CustomCharacter but I didn't want to make it THAT custom to where it uses a CustomCharacterMovement rather than CharacterMovement.

    So, I ended up making the changes directly in CharacterMovement's OnOnEnable

    protected virtual void OnOnEnable()
    {
    // TODO: Remember to migrate this on the next release.
    if (_rigidbody == null)
    {
    _rigidbody = GetComponent<Rigidbody>();
    InitRigidbody();
    }
    .....

    Maybe making CharacterMovement's private _rigidBody and/or protected InitRigidbody() something more accessable from the Character could be a potential feature enhancement.

    I don't know if that breaks any design ideas, but it would have been helpful to be able to do something like this from the Character: characterMovement.ReInitRigidbody(newRigidBody)

    Let me know if I missed some much easier way to accomplish that. I would be happy to hear that I made it too difficult :)

    For now, my toon person can get on and off the vehicle.

    Thanks!
     
  18. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Hello @Garganturod

    The easiest way to disable a character is setting its movement mode to None and you can use the IsDisabled() method to poll its state, later when needed to re-enable the character, simply set its MovementMode to walking or falling as those are automatically managed based on its grounding state.

    When you disable a character (set its movement mode to None), internally it is turned into a kinematic rigidbody and save its current velocities, so it won't be affected by external forces, later when re-activated, it set the Rigidbody back to dynamic and restore its previously saved velocities (if needed / desired).

    Worth note input could be still processed when disabled, so you can poll the IsDisabled state if your animations require it.

    Regards,
    Krull
     
    ge01f likes this.
  19. RSolids

    RSolids

    Joined:
    May 19, 2021
    Posts:
    22
    Thank you! I'll try out that method as well
     
    Krull likes this.
  20. mookfasa

    mookfasa

    Joined:
    Dec 21, 2016
    Posts:
    46
    @Krull

    I am working on a Dash and noticed that the player is dashing different distances when they are on the ground vs in the air. If there a way to have the character always dash the same distance using the LanchCharacter method?
     
  21. AFarrell

    AFarrell

    Joined:
    Apr 24, 2016
    Posts:
    18
    Hey there! ECM2 is so good, loving it so far! I was wondering if there is a way to apply a slope speed modifier to root motion controlled animation that is using the basic forward/turn parameters?
     
  22. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Yes, the LaunchCharacter does not modify the Character's current movement mode; basically it lets you modify the Character's velocity in a controlled way, so it will be affected by the movement mode friction.

    You can make use of the properties: useSeparateBrakingFriction and brakingFriction, this will override the current movement mode friction only when useSeparateBrakingFriction is enabled (useSeparateBrakingFriction == true)

    So for a dash, when you begin a dash you enable useSeparateBrakingFriction and set the brakingFriction to your desired value, later when dash time ends you disable useSeparateBrakingFriction, eg: useSeparateBrakingFriction = IsDashing(); This way you can easily bypass the movement mode friction without having to cache / restore its values.

    Another alternative is to dash only in Flying MovementMode, so your dash will always behave the same. A bonus of this method is it already disables gravity for you.
     
  23. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Happy to hear you liked ECM2!

    About your question, you can use the same approach as the slope speed modifier example, however when using root motion your animation is the one directly controlling the velocity so if you want your character move faster / move slower you will need to modify your animation speed, e:g Want to walk faster? Play the animation to walk faster. Want to turn 90 degrees? Play an animation that turns 90 degrees.

    Alternatively you can scale the velocity given by the RootMotionController. For example in the included slope speed modifier, override the CalcDesiredVelocity as follows:

    Code (csharp):
    1.  
    2. protected override Vector3 CalcDesiredVelocity()
    3. {
    4.     if (useRootMotion)
    5.         return rootMotionController.animRootMotionVelocity * GetSlopeSpeedModifier();
    6.  
    7.     return base.CalcDesiredVelocity();
    8. }
    9.  
    So it modifies the root motion velocity with the slope speed modifier.
     
  24. VinnMarty

    VinnMarty

    Joined:
    Jan 6, 2019
    Posts:
    3
    Hi there! Loving the asset so far, but got a few questions about implementing some features I need. I hope these questions aren't dumb to make haha

    1) I know there's examples for climbing ladders, swimming and cinemachine, but I was wondering what would be the best approach for using all of these together. I'm already using the cinemachine example script as my base but I want to add the other movement options to that without making spaghetti code.

    2) I need to add a first-person toggle in my game (swapping between third-person and first-person cameras with the press of a button, like when using the bow in Ocarina of Time for example), would it be best to just add a FPS cinemachine virtual camera or to swap between a TP and a FP character controller?

    3) My game will feature 2 playable characters that you can swap between at any point to solve puzzles (kinda like in LEGO games), is there a way I can use the agent controller so the idle player follows the active one and vice-versa when I swap between them?

    Thank you so much in advance!
     
  25. AFarrell

    AFarrell

    Joined:
    Apr 24, 2016
    Posts:
    18
    Very cool! Thanks for the reply :)
     
    Krull likes this.
  26. unity_qYF9IhUfSdNuiw

    unity_qYF9IhUfSdNuiw

    Joined:
    Feb 20, 2018
    Posts:
    2
    Hey, I'm very happy with ecm2. But I tried to use it with A* Pathfinding from Arongranberg, instead of the normal navmesh. Any ideas where to start or on what example I could look at to get this running? At the moment the character is floating in the air, because it cant detect the ground.
     
  27. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Thank you, happy to hear you like it!

    While ECM2 includes several Character classes, the 'real' base class is the Character this is the one which implements all the movement and mechanics, or in other words without this class the system won't work, while other Character classes, e.g: FistPersonCharacter, ThirdPersonCharacter, AgentCharacter etc. simply are extending the base Character class to add extra functionality so it's easiest for users choose one of those based on their game requirements but not mandatory at all.

    For example, if you review the ThirdPersonCharacter class basically it is just adding input related code to control the camera, so it's perfectly fine (and sometimes desired) to use the Character class as your parent class.

    ECM2 is based on inheritance so the general approach is create a custom character class (e.g. extending Character class) where you implement it desired mechanics, so in the end this character class will define a Character capable of perform several actions like climb ladders, run, crouch, slide, etc. pretty much like included examples but in a same Character class.

    Yes, using Cinemachine for this will make it much easier so your custom character (eg: extending the base Character class) will be capable of toggle the desired perspective.

    This is a typical case for a Controller:

    A Controller (while not a concrete representation exists in ECM2) is the interface between a character and the human player (or AI) controlling it, be it in the form of a c# script or a visual scripting system like Bolt.

    Or to simply put, a script controlling your character through its input action command methods like SetMovementDirection, Jump, StopJumping, Crouch, StopCrouching, etc. So as this controller is not directly tied to a particular Character you can easliy swap your controlled character.

    Hope this helps you, however as this is an advanced usage case, please let me know if you have further questions.
     
  28. Minzie

    Minzie

    Joined:
    Jul 26, 2019
    Posts:
    77
    Hi @Krull,

    I've bought ECM2 previously & only tested it today. I like it so far :) I have several questions:
    1. Swimming demo: When I hold space it will float the character up, however when it floats near/ up to the water level, character will bounce up & return back into the bottom of the water. Is it possible to make the character stay afloat at the water level (when space is hold)?

    2. I want to make the character sprint to slow down (after landing from sprint then jump) before continue to run at full speed. Which setting should I look into for this?

    Thanks a lot for your help.
     
    Last edited: Nov 2, 2021
  29. ideletemyself

    ideletemyself

    Joined:
    Feb 17, 2021
    Posts:
    8
    Greetings @Krull,

    I've come across an issue that when a player mashes a bunch of keys on the keyboard(my game is highly tense and so players can/do freak out) trying to evade obstacles and enemies they can get locked into my RunningJump animation.

    I've added some Debug.Log throughout my movement logic and when the animation's state locks GetMovementInput() no longer reads any values in the debug yet the player can still be steered with WSAD and nothing else.

    Any ideas what could be happening? Here's my code:

    Code (CSharp):
    1.  public void InteractWithAnimancer()
    2.         {
    3.             if (GetMovementInput() != default)
    4.             {
    5.                 if (IsOnGround())
    6.                 {
    7.                     _Locomotion.TryEnterState();
    8.                     Debug.Log("Walking in InteractWithAnimancer.");
    9.  
    10.                     if (_crouchButtonPressed)
    11.                     {
    12.                         _CrouchWalkingState.TryEnterState();
    13.                         Debug.Log("Crouch Walking in InteractWithAnimancer.");
    14.                     }
    15.  
    16.                     if (IsSprinting())
    17.                     {
    18.                         _RunToSprint.TryEnterState();
    19.                         Debug.Log("Running in InteractWithAnimancer.");
    20.                     }
    21.  
    22.                     if (IsWalking() && GetJumpInput() != default && !IsJumping())
    23.                     {
    24.                         _RunningJump.TryEnterState();
    25.                         Debug.Log("Running Jump in InteractWithAnimancer.");
    26.                         Debug.Log(GetMovementInput());
    27.                     }
    28.                     else
    29.                         _Locomotion.TryEnterState();
    30.                 }
    31.             }
    32.             else if (GetMovementInput() == default)
    33.             {
    34.                 if (IsOnGround())
    35.                 {
    36.                     _Character.Idle.TryEnterState();
    37.                     Debug.Log("Idle in InteractWithAnimancer.");
    38.  
    39.                     if (_crouchButtonPressed)
    40.                     {
    41.                         _CrouchIdleState.TryEnterState();
    42.                         Debug.Log("Crouch Idle in InteractWithAnimancer.");
    43.                     }
    44.  
    45.                     if (GetJumpInput() != default)
    46.                     {
    47.                         _Airborne.TryEnterState();
    48.                         Debug.Log("Jump Straight Up in InteractWithAnimancer.");
    49.                     }
    50.                 }
    51.             }
    BTW- using Animancer not Animator and have already gotten advice from that asset's creator. Everything is working fine on that end. Also using Root Motion for all movement, jumps, etc.
     
  30. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Hi @unity_qYF9IhUfSdNuiw,

    Mmm, unfortunately I have not much experience with this popular package, however I think you could follow an approach similar to the one used by the ECM2 AgentCharacter.

    With the AgentCharacter basically it extends a regular Character to add navigation capability making use of the NaveMeshAgent. It work as follows:

    When we click a desired destination, will ask the NavMeshAgent a new path to reach the given destination, while the Agent has a path (eg: has not reached destination), we use the agent's desired velocity as our character's movement direction so it keeps moving towards the agents' destination.

    Basically we only use the agent as a 'brain' moving the character towards its desired velocity until it reaches its destination.

    Regards,
    Krull
     
  31. ideletemyself

    ideletemyself

    Joined:
    Feb 17, 2021
    Posts:
    8
    Just a quick addition to my issue. I think I’ve narrowed it down to turning while doing the running jump.

    Maybe something in how I’m applying rotation in the RootMotionController is causing it to wig out and lock the animation state?
     
  32. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Hello @duminju1990,

    Thank you for purchasing ECM2 and happy to hear you like it!

    About your questions:

    1.- Yes, by default a Character do not implements a swimming movement as it is kind of game dependant, so the demo implements a basic one, where it moves the character up while jump key is pressed, once it reaches a immersion depth threshold it (depth > 0.65f ) it trigger a jump out of water.

    In your case you can remove the jump section and probably use the depth ratio to dampen the input as the character reaches water line. Additionally you can tweak the water friction and its buoyancy, for example if you set the buoyancy above 1 (e.g: 1.1) the character will float back to water line.

    2.- For this you can simply modify its maxWalkSpeed and / or its sprint speed multiplier, gradually lowering up to 0, so it will slow down the character, kind of fadeout the Sprint Speed Multiplier or as commented earlier, lower its MaxWalkSpeed will work too.

    Regards,
    Krull
     
    Minzie likes this.
  33. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Hi @ideletemyself

    Mmm, if your character is implementing a kind or root motion based jump, that's the cause. By default a Character movement is constrained to the ground by default, so it will discard the vertical component of velocity and only preserves gravity effects (falling), in other words, if your character is jumping with root motion, it won't work unless you explicitly allow it.

    The suggested way to implement root motion based jumps or any vertical movement (eg: climb) is to set your character movement mode to flying, later when your jump animation completes, set it back to falling or walking as these are maged based on the character's grounding status.

    Hope this helps, however if need any further help, please let me know.

    Cheers,
    Krull
     
  34. ideletemyself

    ideletemyself

    Joined:
    Feb 17, 2021
    Posts:
    8
    @Krull

    I had implemented the suggested technique of setting to Flying then to Falling during the OnExit function.

    It works most of the time but again during rotation during the running jump that’s what seems to cause the issue.

    also tried using the JumpApex stuff to set the MovementMode. Falling once it reaches the apex but the JumpApex stuff didn’t seem accessible or wasn’t working as I’d expected.

    I guess if worst case I can just disable root motion but I’ve been trying to avoid that because I want to learn how to do root motion jumping.

    I’ll try messing around with my OnExit & On Disable functions for my RunningJumpState & hopefully that will help. Any other input is greatly appreciated. Thanks!
     
  35. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    I would appreciate it if you could share your custom character or controller because at this moment I am mostly blind, feel free to contact me through a support email if you prefer.

    Having said that, worth note ECM support root motion through its RootMotionController who is responsible to feed the animation velocity and rotation, so as you are using Animancer, I think you will need to modify this script to feed the Animancer root motion data so the ECM character receive it.

    Also, please make sure to set rotation mode to OrientWithRootMotion when root motion should handle the character rotation, otherwise root motion will be ignored even if useRootMotion is enabled.

    Honestly to do a root motion jump, you just need to set the character in Flying modement mode, enable useRootMotion and if the jump should handle rotation, set rotation mode to OrientWithRootMotion.

    However, as commented above, your model must have the RootMotionController component as this is the one responsible to feed animation velocities to ECM Characters.

    Regards,
    Krull
     
  36. ideletemyself

    ideletemyself

    Joined:
    Feb 17, 2021
    Posts:
    8
    @Krull

    I sent you an email but you can ignore that if you wish. So sorry I hadn't properly consulted the documentation again and it answers all the questions I had for you in that email.

    My apologies again.

    Your MyCharacterController script helped as well.
     
    Krull likes this.
  37. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Hi @ideletemyself,

    Dont worry about it, and happy to hear you were able to solve your issues!

    Do not hesitate to message me back if you need any further help.

    Regards,
    Krull
     
  38. Sapien_

    Sapien_

    Joined:
    Mar 5, 2018
    Posts:
    102
    Hello. When I use Add force on the character if the character. If the character is on a surface with a rigid body, the add force is heavily dampened or there is a lot of drag. If it is on a surface that isn't a rigid body, add force works fine. This is an issue because the ECM2 moving platform mechanics needs moving platforms to be rigid bodies. How do I fix this?
     
  39. ideletemyself

    ideletemyself

    Joined:
    Feb 17, 2021
    Posts:
    8
    Heya @Krull,

    Just another message saying you can ignore my last email again. lol. Sorry I don't want to waste your time I know it's valuable..

    I solved my issue by changing my RunningState to have LateUpdate instead of Update and just did all my InputAction detection and whatnot there and it works perfectly!

    Still curious about the Ground Detection thing but again I got around that as well so it's not an issue just more a curiousity... Thanks again!
     
    Krull likes this.
  40. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    488
    Hello,

    is there any update in the work maybe coming before end of the year with (hopefully) some additional demo/examples for additional features? Or is it now features-complete and nothing is planned outside of small bug fixes here and there (if any) ?
     
  41. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    Thanks for considering this! It will help to be able to use this for animation.
     
    Krull likes this.
  42. Deleted User

    Deleted User

    Guest

    Would there be a way to smooth out the rotation on the 3rd person controller ?

    Code (CSharp):
    1.  
    2.         protected override void OnLateUpdate()
    3.         {
    4.             base.OnLateUpdate();
    5.             cameraTarget.rotation = Quaternion.Euler(_pitch, _yaw, 0.0f);
    6.         }
    7.  
    Seems a bit too harsh; I have tried with smoothDamp but it's very buggy.
    Any ideas ?
     
  43. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Hello @Sapien_

    Yes, I was able to reproduce this issue, and its caused by the way it currently handles platforms per and post physics internal update, so after the physics internal update basically try to 'catch' the missing frame provided by the GetPointVelocity, so while it 'works' as platform movement its far from being perfect.

    The good news is as part of the upcoming MAJOR update, platforms are 'first-class citizen' and fully transparent for you (the users) so the PlatformMovement is gone and now the Characters can (if decided) use as platform kinematic rb, dynamic rb, animated, scripted, tweened, or even fully simulated vehicles (eg: a Edy's Vehicle Physics') etc. So this definitely will solve your current issues.

    Regards,
    Krull
     
  44. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Hi @Necka_

    Yes, definitely will release the 1.1.0 major update before the end of year.

    I was aiming for this month's 15th release, but unfortunately as ECM is not my full time job, I could not accomplish this date. Having said that, the update is nearly complete but still porting examples, as unfortunately there are some braking changes but IMHO totally worth it!

    As previously commented, without fully disclosing the whole new features yet, is ECM2 will be now fully kinematic, completely refactored the CharacterMovement class completely isolating it, so for example, now you can use it without any other component pretty much like the Unity Character Controller, eg: characterMovement.Move(newVelocity) .

    As part of this new CharacterMovement, the ground detection and steps (actually all class) uses a new algorithm allowing better movement constraint and ground detection with greater flexibility, also steps can now be any height, etc.

    Added examples of using CharacterMovement alone, Eg: Added a 'BaseCharacter' example who replicates very close the Easy Character Movement BaseCharacterController, among other examples.

    It also has been designed to be fully compatible with custom physics updates as the movement is encapsulated in its Move method, so after calling this your character is in its current state, simplifying things a lot!

    So stay tuned for this and hopefully you won't have to wait much more ;);)

    Cheers,
    Krull
     
    RogDolos and jimmygladfelter like this.
  45. Sapien_

    Sapien_

    Joined:
    Mar 5, 2018
    Posts:
    102
    This is all good to hear Krull!
     
    Krull likes this.
  46. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    771
    Mmm, do you refer to the default ThirdPersonCharacter ? Could you please refer to the example so I could test it?

    Having said that, you can add some 'lag' to the _yaw and _pitch vars (smoothdamp) but if using the default ThirdPersonCameraController you can use the Mouse / Controller sensitivity to smooth its movement.

    Regards,
    Krull
     
  47. mookfasa

    mookfasa

    Joined:
    Dec 21, 2016
    Posts:
    46
    @Krull

    Is there a way to have the character float a certain distance above the ground when entering a trigger? I was messing around with turning the pausing the ground constraint and turning the gravity from -30 to 1 but it was pretty unstable.
     
  48. mookfasa

    mookfasa

    Joined:
    Dec 21, 2016
    Posts:
    46
    Sounds awesome! Do you know when this update will be released?
     
    Krull likes this.
  49. ideletemyself

    ideletemyself

    Joined:
    Feb 17, 2021
    Posts:
    8
    Would this possibly help with integration with assets like Puppetmaster for ragdoll/animation blending?

    I'm trying to mess around with that now and am having issues since it adds a Rigidbody & Capsule Collider to various body parts. I'm waiting to hear back from that dev but when I saw this I thought I'd go ahead and ask about that now lol.

    I think I'd just have to apply ECM2's custom gravity to each Rigidbody but I'm unsure obviously. It wants to move as I can see it attempt to do the jump animations but it's just stuck in a T pose.
     
  50. re-mouse

    re-mouse

    Joined:
    Jun 21, 2019
    Posts:
    1
    I'm working on multiplayer game, that requires client-side prediction. We calling transform.Translate multiple times on one frame, and that cause problems with physic, we searching an alternative that can solve the problem with calculating physics. Can this movement "controller" from asset able to call move multiple times in one frame, and normally calculate physics?