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

[RELEASED] Easy Character Movement 2

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

  1. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hi @mookfasa

    The easiest way is add an offset to your character model, so while the capsule remains on ground, you can offset your model from ground as needed.

    - Krull
     
  2. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    It should help yes, however I think your issues could be related to some collision between Character's Capsule and your model colliders. A possible solution for this is making use of collision layers so they don't 'see' each other.

    - Krull
     
  3. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hello @re-mouse,

    First of all thank you for your interest in ECM2.

    About your question: I am afraid current live version cant, since being a dynamic rigidbody based controller it is moved by velocity and its the internal physics simulation the one who physically moves the 'character' to its new position, so it is tied to the physics simulation, I mean, its transform is updated by PhysX.

    Having said that, as commented a few posts above, the upcoming update will change things a lot, as ECM2 will be fully kinematic, and the CharacterMovement component (aka: character motor) behaves like Unity Character Controllers, where you call its Move method with a new velocity, and after this, the character's transform is updated as this method perform collision constrained movement.

    However, just like Unity's Character Controller, it is suggested to call Move method 1 time per frame, it can be called multiple times if needed.

    I plan to release this new version in the first days of December, however this is not set in stone but I'm really trying to.

    - Krull
     
  4. ideletemyself

    ideletemyself

    Joined:
    Feb 17, 2021
    Posts:
    8
    Actually, Puppetmaster does take Layers into account during setup.

    My issue was/is actually due to Animancer. Apparently, Puppetmaster & Animancer only play nicely together when the Animator "Update Mode" is set to Normal. I had mine set to Animate Physics which will not work with Puppetmaster for some reason.

    I switched to Normal and everything works except now my player animations look really weird like his feet flop in unnatural ways when walking and in general is just not as responsive anymore. I'll have to contact Animancer's dev to see what the deal is with that.

    I appreciate your input and I hope this info will help someone else in the future who's also using Animancer, ECM2 and Puppetmaster :)
     
    Keitaro_Ura and Krull like this.
  5. Organik05

    Organik05

    Joined:
    Feb 15, 2016
    Posts:
    10
    How does ECM2 work with custom animations and animations from Adobes free animations? Are they pretty easy to implement?
     
  6. Rin-Dev

    Rin-Dev

    Joined:
    Jun 24, 2014
    Posts:
    574
    The TLDR of it : Mixamo animations and other packs work with it, I can attest that they all work fine with ECM2 since its just sending data to the animator. If you can use the animator fine, then you won't have issues.

    ECM2 itself doesn't control your animations but gives you an example of how you could implement them. One way is a script on the model with the animator that takes variables from the Character script and sends that to the animator. Another way is with the Character script itself, as it has an Animate function that you can also use to feed custom data.
     
    Krull and Organik05 like this.
  7. Organik05

    Organik05

    Joined:
    Feb 15, 2016
    Posts:
    10
    Hey thanks, Rin-Dev, I appreciate it. So I can just use the character from ECM2 Minus the animations given using the mixamo ones and won't have an issue. Thanks a bunch, man!
     
    Rin-Dev likes this.
  8. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hi @Organik05,

    Yes exactly as @Rin-Dev says (I could not have said it any better :D) ECM2 do not use animation or force you to use animations in a specific way, so you basically feed your Animator with information provided by ECM like if is the character grounded, is running, its movement direction, its speed, etc as needed by your animations.

    Kind regards,
    Krull
     
    RogDolos, Organik05 and Rin-Dev like this.
  9. VR_Junkie

    VR_Junkie

    Joined:
    Nov 26, 2016
    Posts:
    77
  10. mookfasa

    mookfasa

    Joined:
    Dec 21, 2016
    Posts:
    46
    @Krull Is there a way to to do it with the character controller itself and not adjusting the offset of the model? I am trying it make it when a player enters a trigger there is a fan below the character making it float.
     
  11. FabianGameDev

    FabianGameDev

    Joined:
    Oct 7, 2019
    Posts:
    1
    Hi @Krull , first of all great work on ECM2, slowly getting into it and looking forward to the update.

    My question would be what approach to take if I want to make the (first person) character walk on the INSIDE of a sphere (similar to the planet example), e.g. walk up the curved walls all the way until the character is upside down?

    I need to adjust the characters rotation, so that the feet always stick to the ground/wall. Also stairs/slope angles should work relative to the characters rotation.

    If you see the example, gravity (red) is going from the core of the sphere to the outside. The player (green, already rotated 90°) should be able to walk up the stairs.

    Does this even work with ECM2? It seems ECM2 is always using the global up axis like Vector3.up.
     

    Attached Files:

  12. dotmeep

    dotmeep

    Joined:
    Apr 14, 2021
    Posts:
    7
    Hi @Krull --- I've had a lot of success using your ECM2 package. I'm running into an issue with Cinemachine, hoping you might be able to help. I have a player character with a camera target transform attached. I'm controlling the character with ECM2. I have RotationMode set to OrientWithMovement when the character is moving normally, with a 3rd Person Follow Virtual Cam.

    This blends into an over the should 3rd Person VCam when the player switches to aiming. At this point, ECM2 switches to OrientToCameraView so the player can circle in place while aiming.

    The issue is if the character is facing away from the camera, and pressing the aim action, the camera swings wildly behind the character as the character quickly reorients itself to face the camera.

    I can see why this happens but I'm not sure if I can get the VCam to reorient itself behind the characters present position on activation. I can post a quick video if this isn't clear enough. Much appreciated!
     
  13. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
  14. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Ah yes, for that kind of behaviour you want to implement something like the Floater from the demo, simply adding a constant upwards force (higher than character's gravity), just make sure you disable / pause character's ground constraint otherwise the character will remain attached to ground.

    For example:

    Code (csharp):
    1. public class Floater : MonoBehaviour
    2. {
    3.     private void OnTriggerStay(Collider other)
    4.     {
    5.         if (!other.CompareTag("Player"))
    6.             return;
    7.  
    8.         Character character = other.GetComponent<Character>();
    9.         if (!character)
    10.             return;
    11.  
    12.         if (character.IsOnGround())
    13.             character.PauseGroundConstraint();
    14.  
    15.         character.AddForce(character.GetGravityVector() * -1.05f);
    16.     }
    17. }
     
  15. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Yes, it is possible as you already noticed in the included planet walk example and actually that is the approach you should follow, rotating character and gravity accordly.

    Worth note that while the character can be freely rotated its up vector is always aligned along capsule y-axis so the capsule's top sphere will always be the character's 'head' and the bottom sphere its 'feet'.

    Let me know if you have any further questions.
     
  16. Alienouz

    Alienouz

    Joined:
    Nov 3, 2019
    Posts:
    5
    Hi @Krull
    I hope you're doing fine.
    I'm trying to make a simple attack to the Third Person Controller example with new script.
    I added the attack action on the player input as you can see.

    upload_2021-11-21_1-52-16.png

    and I write this code.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.InputSystem;
    5.  
    6. public class PlayerActionz : MonoBehaviour
    7. {
    8.  
    9.     public PlayerInput _playerinput;
    10.     public Animator _animator;
    11.  
    12.     // Start is called before the first frame update
    13.     void Start()
    14.     {
    15.         _playerinput = GetComponent<PlayerInput>();
    16.         _animator = GetComponent<Animator>();
    17.     }
    18.  
    19.     // Update is called once per frame
    20.     void Update()
    21.     {
    22.         if(_playerinput.actions["Attack"].ReadValue<float>() > 0f)
    23.         {
    24.             _animator.Play("Attack_02");
    25.         }
    26.     }
    27. }
    28.  
    when I attached the code to the ECM2_CharacterController I got this error.

    KeyNotFoundException: Cannot find action 'Attack' in 'ECM2_ThirdPerson_InputActions (UnityEngine.InputSystem.InputActionAsset)'
    UnityEngine.InputSystem.InputActionAsset.get_Item (System.String actionNameOrId) (at Library/PackageCache/com.unity.inputsystem@1.0.2/InputSystem/Actions/InputActionAsset.cs:275)
    PlayerActionz.Update () (at Assets/Animationz/PlayerActionz.cs:22)


    I moped the input from ECM2_CharacterController and the animator from the UnityCharacter model

    upload_2021-11-21_1-57-34.png

    can you please tell me how to do it the right way?

    sorry for the long post and thanks in advance
     
  17. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hello @Alienouz,

    Make sure you add your Attack input action into the InputActionsAsset then you will need to initialize your new Attack InputAction and enable it.

    Please take a look at the user manual, Adding a custom InputAction to MyCharacter (page 35) as this shows the required steps to add a custom InputAction.

    Regards,
    Krull
     
  18. mookfasa

    mookfasa

    Joined:
    Dec 21, 2016
    Posts:
    46
    @Krull
    I am trying to wrap my head around the OnCustomMovementMode method. What I am trying to do is when I switch the movement mode to the custom setting and have it the player move in different ways. Right when I switch to Custom nothing happens, even though the code under handle input is correct.



    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using ECM2.Characters;
    4. using ECM2.Common;
    5. using UnityEngine;
    6. using UnityEngine.InputSystem;
    7.  
    8. public class CCC_Script : Character
    9. {
    10.     public bool enterCustomMoveMode;
    11.  
    12.     public enum MyCustomMovementTypes
    13.     {
    14.         None,
    15.         CustomMoveType,
    16.     }
    17.  
    18.     [SerializeField]
    19.     private MyCustomMovementTypes _myCustomMovementTypes;
    20.  
    21.  
    22.     protected override void OnUpdate()
    23.     {
    24.         base.OnUpdate();
    25.  
    26.  
    27.         if (enterCustomMoveMode)
    28.         {
    29.             SetMovementMode(MovementMode.Custom);
    30.         }
    31.         else
    32.         {
    33.             SetMovementMode(MovementMode.Walking);
    34.         }
    35.     }
    36.  
    37.     protected override void OnMove()
    38.     {
    39.         base.OnMove();
    40.     }
    41.  
    42.     /// <summary>
    43.     /// Updates the Character's rotation based on its current RotationMode.
    44.     /// </summary>
    45.  
    46.     protected override void UpdateRotation()
    47.     {
    48.         base.UpdateRotation();
    49.     }
    50.     /// <summary>
    51.     /// Handle Player input, only if actions are assigned (eg: actions != null).
    52.     /// </summary>
    53.  
    54.     protected override void HandleInput()
    55.     {
    56.         base.HandleInput();
    57.         Vector2 movementInput = GetMovementInput();
    58.         if (enterCustomMoveMode)
    59.         {
    60.             // Move like an FPS
    61.             Vector3 movementDirection = Vector3.zero;
    62.             movementDirection += Vector3.right * movementInput.x;
    63.             movementDirection += Vector3.forward * movementInput.y;
    64.             movementDirection = transform.TransformDirection(movementDirection);
    65.             SetMovementDirection(movementDirection);
    66.         }
    67.     }
    68.  
    69.  
    70.     protected override void OnCustomMovementMode(Vector3 desiredVelocity)
    71.     {
    72.  
    73.         switch (_myCustomMovementTypes)
    74.         {
    75.  
    76.             case MyCustomMovementTypes.None:
    77.                 {
    78.                     Debug.Log("In None Mode");
    79.                     break;
    80.                 }
    81.  
    82.             case MyCustomMovementTypes.CustomMoveType:
    83.                 {
    84.                     CustomMoveType(desiredVelocity);
    85.                     break;
    86.                 }
    87.  
    88.         }
    89.  
    90.     }
    91.  
    92.  
    93.     public virtual void CustomMoveType(Vector3 desiredVelocity)
    94.     {
    95.         Debug.Log("In Custom Mode...Turn off Rotation for FPS");
    96.         SetRotationMode(RotationMode.None);
    97.     }
    98.  
    99. }
    100.  
     
  19. mookfasa

    mookfasa

    Joined:
    Dec 21, 2016
    Posts:
    46
    Thank you once again!
     
    Krull likes this.
  20. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hi @daveofthemeep,

    First of all, sorry for the late reply.

    About your question, are you using the included Cinemachine example CMThirdPersonCharacter? If so, this could be due to manually rotating the camera target transform (_yaw, _pitch fields) basically we are manually rotating the camera. Worth note the rotation mode only affects the character's rotation and should not modify your camera's rotation / position.

    Having said that, I tried a quick test with the same CMThirdPersonCharacter toggling rotation mode and could not reproduce it, so if possible please add the video so I can get a better understanding of your issue.

    Looking forward to hearing from you.

    Regards,
    Krull
     
  21. Alienouz

    Alienouz

    Joined:
    Nov 3, 2019
    Posts:
    5
    Many thanks Krull for the reply.
    I will check this out and hopefully I will make it work.
    thanks again
     
    Krull likes this.
  22. Rin-Dev

    Rin-Dev

    Joined:
    Jun 24, 2014
    Posts:
    574
    I'm trying to implement the Dash mechanic into the side scroller template. I can get it to go left and right but not up and down. Any suggestions?
     
  23. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hi @mookfasa ,

    I suggest first try to model your desired mechanics using one of available movement modes, however if your desired mechanic does not fit a particular movement mode a custom movement mode is a great option to fully control how your character should move. The included Ladders example shows how to implement a custom movement mode, as this is basically a path following, it's much easier to implement it using a custom movement mode as this offers greater flexibility and easier housekeeping.

    When creating a custom movement mode I suggest you follow the same approach used in the Ladder Climb example. A particularly important part here is to make use (extend) the OnMovementModeChanged method, as this basically acts as a typical FSM onEnter / OnExit state, so you should use it to initialize / restore values your custom movement mode needs.

    Here is the OnMovementModeChanged from ladder climb example:

    protected override void OnMovementModeChanged(MovementMode prevMovementMode, int prevCustomMode)
    {
    // Call base method implementation

    base.OnMovementModeChanged(prevMovementMode, prevCustomMode);

    // Entering climbing movement mode

    if (_movementMode == MovementMode.Custom && _customMovementMode == (int) CustomMovementMode.Climbing)
    {
    StopJumping();

    characterMovement.ConstrainToGround(false);
    }

    if (prevCustomMode == (int) CustomMovementMode.Climbing)
    {
    // Leaving climbing movement mode

    _climbingState = ClimbingState.None;

    characterMovement.ConstrainToGround(true);
    }
    }

    As you can see, it handles entering climbing mode AND exiting climbing movement mode. On Enter, we cancel any possible jump and disable character ground constraint, later when leaving this mode, we reset its sub-states, and re-enable ground constraint.

    I suggest you take a look at the included Ladders example source code (it's fully commented) as it shows a fully functional custom mode example and definitely should help you to get a better understanding of it.

    Kind regards,
    Krull
     
    RogDolos and mookfasa like this.
  24. Krull

    Krull

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

    Makesure you disable ground constraint (e.g: characterMovement.ConstrainToGround(false) ) otherwise the character will be limited to planar (horizontal) movement only.

    Cheers,
    Krull
     
  25. Fabbs

    Fabbs

    Joined:
    Dec 2, 2013
    Posts:
    43
    Hi! Loving the asset so far but i am having a bit of trouble with wrapping my head around rotating the character. I have a first person character that i want to rotate with a platform, think a gravity plate floor rotating freely in space, so it can rotate on any axis. Updating gravity is figured out already, but i need to keep the characters feet on the floor. Thanks!
     
  26. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hi @Fabbs,

    Happy to hear you like it!

    About your current issue, yes you will need to rotate both gravity and character to follow the terrain, as the movement is computed relative to the character's up axis, I mean the botom's capsule sphere will always be the character's feet regarding its rotation.

    I attached the same planet walk example, but modified it to use the FirstPersonCharacter so you can get a better understanding of this.

    To use it, simply import it into a project with ECM2 installed.

    Kind regards,
    Krull
     

    Attached Files:

  27. Fabbs

    Fabbs

    Joined:
    Dec 2, 2013
    Posts:
    43
    Fantastic, thank you so much! il check it out.
     
  28. Fabbs

    Fabbs

    Joined:
    Dec 2, 2013
    Posts:
    43
    While the example you provided works fantastic for a globe, im still struggling to rotate the character with another object, think the rotating platforms in the demo scene, but they should be able to rotate on any axis.
     
  29. Sapien_

    Sapien_

    Joined:
    Mar 5, 2018
    Posts:
    102
    Hey @Krull, any news on the update?
     
  30. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hey @Sapien_

    Well about the update, I am happy to say its development is complete with all examples updated plus a few new ones, however still need to update documentation plus add a new user manual for the CharacterMovement component, as now this can be used by itself if desired without Character class, pretty much like the Unity CharacterController.

    Additionally, I do plan to release a series of short videos outlining the changes compared to the current live version, as on the surface it could not be noticed, but trust me, this is a huge update with a completely new fully kinematic CharacterMovement component improved in every possible way.

    Without setting on stone the release date, I do plan to release it this month mostly before Christmas, so If you have not already purchased / updated to ECM2 now it's a great time as it is still on discount :D

    Regards,
    Krull
     
    Sapien_ and RogDolos like this.
  31. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Mmm, the provided example should work as a guide as it uses the surface normal to rotate / align the character's up and gravity. Could you provide an example of what you are trying to achieve, so I can get a better understanding?

    Cheers,
    Krull
     
  32. Fingus1

    Fingus1

    Joined:
    Oct 11, 2020
    Posts:
    2
    Hi @Krull we have recently started using ECM2 to make a 2.5 platformer.

    Everything has been working fine, but the fact that the character uses a capsule collider raises a few issues with a game that requires platforming.

    When the player is far to the end of a ledge the collider makes it so the character is actually below the ground. This feels weird when playing and could affect the jump height.

    My question is: Is it possible to change the capsule-collider to a box-collider?

    (Also lowering the perch or unperch distance didn't solve this for me, it only makes the player slip down when getting close to ledges which made it harder to control)

    Thanks, the engine has been very helpful.

    ledge.png
     
  33. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hello @Fingus1,

    About your question, yes that's a side-effect of being a capsule based controller, you can use the perch / unperch offsets to control when a character leves a 'platform'.

    For example set your perch offset to your character's capsule radius, and your unperch offset to 0, this will make the character fall (slidedown) of a ledge as soon as it moves in an opposite direction from ledge, while it will allows the character to 'perch' when trying to jump into ledge.

    In short no, however as part of the incoming update (v1.1.0) the CharacterMovement component has been completely refactored (completely new actually), and one of its many new features is the addition of 'Use Flat base for Ground Checks' and behaves exactly like the Unreal Engine's UCharacterMovementComponent:

    "Performs groundchecks as if the character is using a shape with a flat base. This avoids the situation where characters slowly lower off the side of a ledge (as their capsule 'balances' on the edge)."

    Here you can find a picture of the updated CharacterMovement component.

    CharacterMovement.png

    Regards,
    Krull
     
    Sapien_ likes this.
  34. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    488
    Hey Krull,
    The update looks really interesting. I'm holding off updating my current project because the refactor might change a lot of things - do you have an idea if this update will drop this week or next? or even later

    Also just a small request: Could you consider adding a basic cover example to the gameplay examples folder?
    Something to just take cover behind a wall (high or low) and move along the proper axis. I can't wrap my head around this with the current controller and your example always give a good head start
     
    RogDolos and Krull like this.
  35. Fingus1

    Fingus1

    Joined:
    Oct 11, 2020
    Posts:
    2
    @Krull That's amazing news. Sounds like using a flat base could solve my issue and be better for precision when platforming.
    Thanks so much, I´ll eagerly await the update.
     
    Krull likes this.
  36. jcporcel

    jcporcel

    Joined:
    Jan 18, 2014
    Posts:
    3
    Just came to say the asset is really cool, easy to use and to extend, and being able to use a flat bottom on the collider on the next update is an absolutely AMAZING feature!. That will make this a perfect controller for games more on the retro 2D side.
    Keep up the fantastic work!
     
    Krull likes this.
  37. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hi guys,

    Yes, I plan to release this BIG update in one two weeks at most, as all lefts to be donde is update documentation, new CharacterMovement documentation as this can be used alone without any Character class if desired, pretty much like a much better version of Unity's CharacterController, and update / create marketing videos.

    I agree with you about the flat base, I think Unreal added it exactly for 2D and 2.5 D games so it will definitely help having this feature :D

    In the meantime, here I attached the updated Character class as it has been refactored too:

    ECM2 Character.png

    Regards,
    Krull
     
    RogDolos likes this.
  38. RogDolos

    RogDolos

    Joined:
    Oct 16, 2012
    Posts:
    42
    I would also like to see a cover-system example, tho I'm aware there are lots of variations of that ("sticky" cover, etc.).

    Edit: meanwhile I'm guessing the Ladder example would be the closest to adapt for cover?
     
    Last edited: Dec 11, 2021
  39. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hi @RogDolos

    Well for the cover example, once I release the 1.1.0 version, I will be able to focus on adding more gameplay / integration examples and cover could be added in future updates.

    The ladder example is basically a path following example, and yes it can be used to move along a cover-wall-path, since you would want to constrain its movement to the cover plane so the character slides along the cover- wall.

    Regards,
    Krull
     
    RogDolos likes this.
  40. Deleted User

    Deleted User

    Guest

    Maybe a stupid question but anyway ...

    Making a quick quick top down prototype; I'm trying to make the character look at (orient) to the cursor.
    Is it best to Raycast to terrain and the TurnTorwards ? Or is there a better way of doing it. I couldn't find any words on that.
    Thanks!
     
  41. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    488
    Hi, not affiliated with the creator but I can give you 1 or 2 hints here.
    For Topdown you don't want to raycast at the terrain. What if there is a hole? or an obstacle or you're at the edge of the world and have nothing to raycast against?

    Usually what people do for topdown is to create and update in their code an invisible plane that is under the player and that's what you raycast against.

    Here is an example of this but if you google raycast topdown unity you'll find plenty of example in the same vein
    I timestamped the video exactly where he code that part:


    For the rotation with ECM2 I personally extended the third person character and added my own custom rotation mode.

    I first declare my enum and also an aimTarget transform (up to you to manage that aim Transform, for me it's part of my weapon system)

    Code (CSharp):
    1. public enum CustomRotationModes { None, RotateToWeaponAim };
    2.  
    3. public class ThirdPersonCharacterNecka : ThirdPersonCharacter
    4.     {
    5.         public Transform aimTarget;
    6.      
    7.      
    8.         [SerializeField]
    9.         private CustomRotationModes customRotationMode = CustomRotationModes.None;
    Then via code when I need to rotate to face my weapon I'd set the rotation mode to "none" and in the
    method "UpdateRotation()" I'd do something if that rotation mode is "none"

    Code (CSharp):
    1.  
    2. protected override void UpdateRotation()
    3. {
    4.     // Is Character movement is disabled, return
    5.  
    6.     if (IsDisabled())
    7.         return;
    8.  
    9.     // Should update Character's rotation ?
    10. RotationMode rotationMode = GetRotationMode();
    11.             switch (rotationMode)
    12.             {
    13.                 case RotationMode.None:
    14.                     //Let's use None for custom rotation
    15.                     //Rotate toward aim target
    16.                     break;
    17.                  case //Other cases from the default method
    18.  
    19.              }
    20. //Now as the rotation mode is set to none and we set via code or in editor the
    21. //custom rotation mode to rotate toward the weapon target
    22.  
    23. CustomRotationModes customRotationMode = GetCustomRotationMode();
    24.             switch (customRotationMode)
    25.             {
    26.                 case CustomRotationModes.None:
    27.                     break;
    28.                 case CustomRotationModes.RotateToWeaponAim:
    29.                     _aimTargetPosition = aimTarget.position;
    30.                     Vector3 targetDirection = _aimTargetPosition - GetPosition();
    31.                     RotateTowards(targetDirection);
    32.                     break;
    33.             }
    I know it's my own custom code so it might not apply to your prototype but maybe that gives you a hint on how to proceed.

    The CustomRotationMode could have more cases where you'd rotate differently or to different things, you get the idea
     
    RogDolos, Krull and Deleted User like this.
  42. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hi @onefoxstudio,

    Pretty much as @Necka_ said :D and remember games are basically 'smoke and mirrors', so it's perfectly fine to use different colliders for different tasks, and even invisible walls are a widely used solution.

    Thank you for your help, and please feel free to post here to help others as this will make it easier for others to find similar solutions.

    Regards,
    Krull
     
    RogDolos, Necka_ and Deleted User like this.
  43. Sapien_

    Sapien_

    Joined:
    Mar 5, 2018
    Posts:
    102
    Hey again Krull I eagerly await your update as I want to send my game to play testers. I do have a question however. This seems to be a very large update, so I have some concerns. Will This cause issues for well developed sontrollers that use ECM2 as its base? I have many Playmaker FSMs that reference the scripts. How easy will converting to the update be?
     
  44. Deleted User

    Deleted User

    Guest

    Thank you @Krull @Necka_ I'm too honest I guess; you're right. We're all liars, I should write this on a big poster in front of me :)
     
    Krull likes this.
  45. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hi @Sapien_

    Well while I tried to ease the update there are some breaking changes, as I have previously commented the CharacterMovement component is basically completely new so I had to modify / replace some data structures as this was needed in order to reduce its network bandwidth and make network synchronization easier among other things.

    About migrating to the new version, it's not really complicated for custom Characters / controllers as most of the changes were on the CharacterMovement component however as you are using
    Playmaker things could be different.

    If your game is almost complete with the current version and does not need a particular new feature I suggest you keep the current version, just like unity does with its LTS versions.

    Regards,
    Krull
     
  46. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    488
    Hey @Krull, a small request that could be really helpful

    Could you add assembly definition to ECM2 by default?

    I personally did it myself but that'd be simpler if that would be done on your level. It's becoming quite the standard on assets from the store.

    As you're already having just one folder for runtime scripts and one for Editor scripts it just need those 2 assembly referencing the new Input system and that's it :)

    upload_2021-12-16_15-52-6.png

    upload_2021-12-16_15-52-24.png
     
    Krull likes this.
  47. Krull

    Krull

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

    Thats a great idea, I will try to make it to the incoming v1.1.0 version, however worth not from this update all ECM2 lives in the EasyCharacterMovement namespace pretty much like UnityEngine.

    Regards,
    Krull
     
  48. fuelless

    fuelless

    Joined:
    Jan 4, 2014
    Posts:
    2
    Hey @Krull,
    First of all, great work on the asset.
    I have just read about the incoming update you are currently working on.
    You have mention networking when talking about it, how "friendly" towards authoritative servers and client-side prediction do you think your new architecture is?

    thanks you!
     
  49. Krull

    Krull

    Joined:
    Oct 31, 2014
    Posts:
    762
    Hi @fuelless

    Thank you!

    About your question:

    While it does not include any network related code or example (yet), one of my goals with this update was to offer better network integration apart from basic 'isMine' method (nothing wrong with it btw :D)

    So with this v1.1.0 being a fully kinematic character controller it encapsulates all the character's movement in a single Move call, pretty much like the Unity's Character Controller, you can even directly replace Unity's Character Controller examples like the Starter Assets - Third Person Character Controller to make use of ECM2 CharacterMovement instead of CharacterController if wanted.

    It also allows you to define the integration time step and work with custom physics integration or custom simulations, so fully authoritative servers and client side prediction should be fully doable as the character is up-to-date right after the Move call.

    It actually includes a custom simulation example using 2 methods, one fully Fixed timestep, and another using a semi-fixed timestep so no interpolation is needed.

    Regards,
    Krull
     
    RogDolos likes this.
  50. fuelless

    fuelless

    Joined:
    Jan 4, 2014
    Posts:
    2
    Great to hear @Krull.
    I really appreciate you taking the time to respond and explain the "macro" details of the new update.
    Looking forward to it.