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:
    580
    It's been stated a couple times, but ECM doesn't handle any animations. You implement those in yourself by using values from Character script.

    So in theory, as someone who's never used Animancer, you'd just have to plug in the right values from your character script and you should be able to feed what you need to the Animancer component.
     
  2. Pixelith

    Pixelith

    Joined:
    Jun 24, 2014
    Posts:
    580

    To show more of what I mean. Both character instances use ECM2. Judging by the boxes ticked, I shouldn't be able to push any characters, let alone merge into them. Wondering what could be the issue?
     
  3. Pixelith

    Pixelith

    Joined:
    Jun 24, 2014
    Posts:
    580
    Honestly ashamed of myself. I made the blunder of setting a custom layer for my enemy and not updating the collision layers of my character movement script. Everything is working fine now!
     
    Krull likes this.
  4. Arthur-A

    Arthur-A

    Joined:
    Mar 17, 2018
    Posts:
    10
    Hi @Krull,

    I've bought the ECM2 and I like it overall, however, I've encountered a very strong camera jitter of the First Person Controller. This is the build of the Cinemachine First-Person Example Scene under "...\Characters\Examples\6.- Cinemachine\1.- First Person".


    It doesn't have that jitter in the editor in the play mode, but when I build it, the jitter is very noticeable.
    Is there a way to make the camera smooth in the build?

    Thank you!
    Arthur
     
  5. Broudy001

    Broudy001

    Joined:
    Feb 12, 2020
    Posts:
    72
    I've used Animancer Pro, works fine, though you'll need to add the animancer code yourself
     
    Krull likes this.
  6. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    527
    And it's bit of a shame honestly. I'm a customer, but keep finding ECM2 quite barebones & lackluster in actual production.
     
  7. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Honestly have not checked or reported it before, however some settings could cause issues, in particular, please make sure the character interpolation is enabled and the Auto Simulation is enabled, otherwise character interpolation would not be applied.

    Also try enabling / disabling the build VSync, sometime it cause some cinemachine issues I noticed before.

    Additionally, plase try this example, as it uses the same underlying code and no jitter here.
     
  8. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Please keep in mind ECM2 / CharacterMovement are general purpose character controller(s), with built in functionality for common movement modes like, walking, sprinting, swimming, crouching, flying, etc pretty much like the built-in Unreal Engine CharacterMovementComponent counterpart.

    Unlike other products, ECM2 has been developed as a lean but comprehensive solution to blend into any project, it do not force you to animate (or even use animations at all) or model your character's (assets) in a particular way, its main goal is to his serve as a robust platform to build your game on top of it.
     
    Pixelith and AGregori like this.
  9. FGRivera

    FGRivera

    Joined:
    Jun 3, 2013
    Posts:
    16
    Hi Krull,

    I was wondering if its possible to use the NavMeshComponents package the ECM agent controller. I am trying to create a manual off mesh link where an agent can jump to a higher spot on the nav mesh, but it won't use the manually created link. Any advice would be appreciated, thank you!
     
  10. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Hi @FGRivera,

    Sure it's possible, however you will need to manually perform the link traversal, as the agent implementation is different to the default unity agent, with ECM2 the character is the one moving the NavMeshAgent, pretty much using it as a 'brain' determining the desired location to move (i.e. its path), and making use of the Agent's desired velocity to perform the character movement (calling CharacterMovement.Move).

    Here you can find an example (not ecm2 related) showing how to manually resolve an off-mesh link.
     
  11. FGRivera

    FGRivera

    Joined:
    Jun 3, 2013
    Posts:
    16
    Awesome, thanks for the info! Did you mean to include a link in the reply?
     
  12. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Yes :D, here it is LINK
     
  13. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    hi
    I'm trying to make my character go up a ladder. How can we achieve it? In theory it's just a vertical up and down movement but i can't figure out how to achieve it.
     
  14. FGRivera

    FGRivera

    Joined:
    Jun 3, 2013
    Posts:
    16
    Thanks!
     
    Krull likes this.
  15. FGRivera

    FGRivera

    Joined:
    Jun 3, 2013
    Posts:
    16
    I think there's a ladder example included in the package
     
    Krull likes this.
  16. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Yes, as @FGRivera already commented, there is a included ladder example, example 5.14 - Ladders (Easy Character Movement 2\Characters\Examples\5.- Gameplay\5.14.- Ladders)

    Worth noting, by default and in order to maintain walkable ground, even at great speeds, ECM2 implements a ground constraint, so in order to leave the ground temporarily (i.e. a jump), or 'permanently' like while climbing a ladder, flying, etc. you must explicitly tell it, in your case, you can simply set the character movement mode to Flying, this will disable gravity effects and let the character freely move up / down as needed.

    Let me know if you need any futher help,
    Krull
     
  17. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    thanks, I'm having an issue with teleporting directly into a moving platform.
    When I place the character directly into the platform, it slides for about 1 second before it locks into the platform. It only happens when I teleport into it (I spawn my player on top of a moving platform).
    How can i make it so that it locks without that 1 second sliding?
     
  18. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Please make sure your spawned character has the impart platform movement enabled or it won't be affected by platform movement at all. Additionally I suggest you teleport your character using the Character SetPosition method, as this ensures its transform and collider are moved at same time.

    Lastly, please take a look at the 5.11 Teleport example, four your case, you can use the platforms from the 4.1 Scripted Platform example, to test it, simply parent the teleporter to any moving platform, it works as expected.
     
  19. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    i'm having an issue. I'm adding a ladder into a moving platform that moves and rotates. I can't get it to work. The character begins sliding and rotating as soon as it changes into the "climbing" state. As if it was floating and apart from the platform.
     
  20. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    where is the code that adds the position/velocity of the moving platform to your character? I think for the ladder I can just parent the character to my ladder holder (it's parent) and then it won't slide or anything since it would move only in local space with the keys. But right now whatever code is checking for a moving platform is adding the velocity and rotation to it when it's "floating" on a ladder.

    I already did this:
    this.impartPlatformMovement= false;
    this.impartPlatformRotation= false;
    this.impartPlatformVelocity= false;

    and then parented the character to the same as the ladder. But it still moves as if something was pushing it with the moving platform.
     
    Last edited: Nov 21, 2022
  21. Pixelith

    Pixelith

    Joined:
    Jun 24, 2014
    Posts:
    580
    I've noticed a little weird behavior using root motion.
    Upward motions will not move you up. I've tried pausing ground constraints and setting movement mode to falling to move up however it keeps me on the ground. Any idea why root motion won't move me up? It isn't really needed as I can just add in the movement in code but I'm curious.
     
  22. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    i think you need to set it to flying for it not to fall on the ground.
     
    Krull likes this.
  23. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Hi @creat327,

    Mmm, yes this is expected as the character is not in direct contact with the platform (ie, not in walking movement mode), so the grounding phase does not track the moving platform.

    You can use the CharacterMovement SetPlatform function to assign the desired platform to the character so it keeps track of it, even if the character is not directly standing over it.

    Later when should leave the platform, set it to null to 'release' the attached platform, i.e: CharacterMovement SetPlatform(null)
     
  24. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Hi @Rin-Dev

    Yes, as @creat327 commented, for any vertical motion involved and in particular for vertical root motion, the character must be on flying movement mode, otherwise it discards the vertical velocity due to maintain walkable ground.
     
  25. chumomo

    chumomo

    Joined:
    Jun 30, 2017
    Posts:
    17
    Hello, great asset! Is there a fast way to stop Character on the edge of the ground?
     
  26. Predulus

    Predulus

    Joined:
    Feb 5, 2018
    Posts:
    90
    I am using ECM2 in my project. I just tried following this tutorial
    part of which involves adding new input actions. I have my new input action created and I enable it in my script. In the inspector it says that OnToggleConsole message will be sent.

    But in my OnToggleConsole handler, my Debug.Log does not execute.

    Is there some way ECM2 might be intercepting messages and stopping them from getting to my handler? I've looked though the doc on Input Actions, but it gets pretty complicated, so I thought I'd reach out.
     
  27. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Hi @chumomo,

    Thank you, happy to hear you like it.

    About your question:

    Not yet, but it is definitely a planned feature for a near future update.
     
    chumomo likes this.
  28. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Hi @Predulus,

    Mmm, in short it should not interfere with your other actions, unless I think the same input keys are assigned.

    You can do a quick test, setting the Character actions property to null, so it disables all the character input related code, and see if your external messages are working correctly.
     
    Predulus likes this.
  29. MichelVictor

    MichelVictor

    Joined:
    Apr 15, 2018
    Posts:
    8
    Hey there, there is any place that people share extensions, like other movements and habilities?
     
  30. Pixelith

    Pixelith

    Joined:
    Jun 24, 2014
    Posts:
    580
    This thread would be the only place I know of.
    There's no discord or other forums mentioned in the first post.

    That all said, if you're trying to incorporate some kind of mechanic everyone here is really helpful and always try to get you in the right direction.
     
    Krull likes this.
  31. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Hi @MichelVictor,

    Yes, as @Rin-Dev commented, no other place at the moment, but feel free to post here if you like :) Just make sure not release ECM2 core code :D

    Regards,
    Krull
     
  32. cabezover

    cabezover

    Joined:
    Feb 27, 2021
    Posts:
    1
    hi there krull, is there a way to only buy the source code?
     
  33. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Hi @cabezover

    Not by itself, however its full source code is included within the store package and you can opt to install only it without any extras, but the source folder for a minimal installation.

    Cheers,
    Krull
     
  34. BlankMauser

    BlankMauser

    Joined:
    Dec 10, 2013
    Posts:
    138
    Do you plan to update the networking examples with photon fusion more? Just curious before I purchase.
     
  35. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Hi @BlankMauser,

    First of all thank you for your interest in ECM2!

    About your questions:

    The current network support is for the character movement component only (similar to unity's built-in cc), and while the characters classes (a higher level classes for common movement modes like walking, falling, etc) uses the character movement component as its character controller, those are not network replicated yet.

    Having said that, that's my planned network update, replicating the character classes. Unfortunately ECM2 is not my full time job (and while I offer the best support I can) developing new features is another story, so this network related update is delayed until I get enough free time from my job.

    Thanks,
    Krull
     
    RogDolos likes this.
  36. WithK

    WithK

    Joined:
    Jun 14, 2022
    Posts:
    3
    Hi!how to prevent character walk off platform?
    ECM1 has boolean value to detect charactor walking on edge,but ECM2 no
     
  37. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Hi @WithK,

    ECM2 does not expose this, since it uses a completely new algorithm (much more robust not raycast based) and actually this is a planned feature to be added, (CanWalkOffLedge feature) so this is not exposed as it will not really be necessary.

    In the meantime you can use the following code snippet to detect if the character is standing on a 'edge' (could be a ledge or not). but for your platform should work fine

    Code (csharp):
    1. bool onEdge = characterMovement.isOnGround && (characterMovement.groundNormal != characterMovement.groundSurfaceNormal);
    2. if (onEdge)
    3. {
    4.     Debug.Log("Standing on edge!");
    5. }
    The new algorithm is based on the character's volume (its whole capsule) and its perch offset, additionally it correctly computes the real surface impact normal (groundSurfaceNormal) to determine if a surface is walkable or not, and not the 'approximated' given by regular CapsuleCast, SphereCast, etc. So when character is standing on an edge, these normals will be different!, so we can be sure the character is standing on an edge.

    Cheers,
    Krull
     
  38. alamaxsong

    alamaxsong

    Joined:
    Sep 4, 2020
    Posts:
    2
    HI, I'm reading ECM2 User Manual. I think there is an error on page 26.
    Screenshot 2022-12-09 at 12.02.25.png
    Should it be SetMovementDirection instead? It's a bit confusing.

    Thanks!
     
  39. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Hi @alamaxsong,

    Yes, you are correct, it should be SetMovementDirection as the code snippet shows.

    I'll fix it in the following update, thanks!
     
    alamaxsong likes this.
  40. Blueskai

    Blueskai

    Joined:
    Jul 25, 2014
    Posts:
    16
    Hey, I think there is a bug when you use the SetPosition method with updateGround enabled, it wont find the ground
     
  41. Blueskai

    Blueskai

    Joined:
    Jul 25, 2014
    Posts:
    16
    never mind, found the issue, character up was zero so the cast direction was wrong, i dont use the move method but rather just set the position and rotation directly
     
  42. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Hi @Blueskai,

    Thanks for the update and happy to hear you were able to solve your issue.

    About the set position vs move, please keep in mind the character movement will only perform its depenetration (overlap resolve) and continuous collision detection in its Move method. The set move position is enough to modify character position as long as the move method is called next frame, i.e, default game loop. otherwise could cause overlaps and penetrations.

    Alternatively, you can use the CharacterMovement MovementSweepTest, FindGround, ComputeGroundDistance methods to sample the world before manually moving your character if needed, like for example, implementing a mantle mechanics, etc. Those functions are the same used internally so will ensure proper data continuity.
     
  43. Qrayn

    Qrayn

    Joined:
    May 25, 2017
    Posts:
    1
    Any progress on FishNet for character controller? :)
     
  44. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Hi @Qryan,

    For ECM2 Characters not yet, sorry. It offers support with CharacterMovement alone, but Characters support has been pushed to next update.

    Having said that, I am about to release (this week) an update where I have refactored folders structure to ease CharacterMovement and Core ECM2 package (Character based classes, etc), so in this update the CharacterMovement package has been merged into ECM2 source code, HOWEVER users who preffer to use the CharacterMovement package by itself will be able to directly download the Character Movement package directly from strore!

    Another important change with this new version v1.3.0 is ECM2 will be released as two versions (included in ECM2 package) one based in Unity's Input System (New) and other version without any dependency on input system, using the Input Manager (old), so users now can decide which version to install.

    Once released this version 1.3.0 (this week), I plan to add network support for Character class, however this will be as an example as depending of your game(s), you may or may not need to replicate Character's data along the net.

    Cheers,
    Krull
     
    MuntyMcFly and TheMK-_- like this.
  45. One_Learning_Man

    One_Learning_Man

    Joined:
    Sep 30, 2021
    Posts:
    81
    When pressing left and right fast, the player will randomly rotate either 0°-180° or 180°-360°. I would like the player to always rotate facing forward 0°-180°. How can I do this?

    upload_2023-1-8_1-14-19.png
     
  46. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Hi @One_Learning_Man

    Actually, I'm not sure if I understand your question correctly.

    By default a Character will rotate towards its given move direction (i.e: RotationMode == Orient To Movement), however you can change its rotation mode to Orient to Camera View Direction, this will cause your character to keep facing towards the camera's current forward resulting in a 'strafing' movement like you expect in third person shooters.


    Another approach is implement a CustomRotationMode and handle your character rotation in there as your game needs.

    Please let me know if you need any further assistance.
     
  47. One_Learning_Man

    One_Learning_Man

    Joined:
    Sep 30, 2021
    Posts:
    81


    When the player goes left or right and have to rotate, I would like them to rotate facing the enemy and not have their back to the enemy.

    upload_2023-1-10_23-36-12.png
     
  48. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    772
    Ah, thanks for clarification.

    For that, you would need to implement a look-at feature, ie: target lock mechanic. Basically you create a direction vector pointing from your character to your target, and rotate the character towards that direction; so while the target is locked, your character will orbit its target.

    Please take a look at the included 5.2.- Target Lock example ( Characters\Examples\5.- Gameplay\5.2.- Target Lock ) for a working implementation of this mechanic.

    Regards,
    Krull
     
  49. TheMK-_-

    TheMK-_-

    Joined:
    Feb 8, 2018
    Posts:
    26
    Hi Krull hope your well,

    I was wondering if you would have any insight on the best way to implement the ladder Climb mechanic on the Third and First person characters?

    And along that line of thought what is the best modular way of extending the third and first person prefabs with new movement modes. I tend to want to add new scripts so I don't have to edit or break the underlying code, but I'm a bit of a noob when it comes to complex code structures and I often do break things while prototyping anyway :D.

    Any advice would be appreciated and thanks again.

    Mike
     
  50. mookfasa

    mookfasa

    Joined:
    Dec 21, 2016
    Posts:
    46
    What code should we be modifying to change the capsule collider to work in the Z Axis? Or maybe a way to offset the capsule forward in Z?
     
    Last edited: Jan 22, 2023