Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

[Released] Character Movement Fundamentals - A Rigidbody-based Character Controller

Discussion in 'Assets and Asset Store' started by JanOtt, Jul 1, 2019.

  1. arminiuspp

    arminiuspp

    Joined:
    Jun 15, 2020
    Posts:
    54
    Do you have any future plans to add a package feature for the new input system?
     
  2. JanOtt

    JanOtt

    Joined:
    Apr 23, 2019
    Posts:
    180
  3. arminiuspp

    arminiuspp

    Joined:
    Jun 15, 2020
    Posts:
    54
    ooh ookay thanks!
     
  4. Sunwer91

    Sunwer91

    Joined:
    Jul 13, 2016
    Posts:
    5
    Hi @JanOtt
    Great job you have done with the plugin.
    I've been using it recently and I had a question about it, I read the documentation but I can't find something I'd like to add, but before doing code for it, I wanted to see if it exists but I didn't see it.
    Is there a direct way to change the camera distance from the character in 3rd person mode? For example like in Mario 64 that you could zoom the camera in or out from the character to see more of the environment?
    Thanks in advance.
     
  5. JanOtt

    JanOtt

    Joined:
    Apr 23, 2019
    Posts:
    180
    Hi,

    To change the camera distance, you'd simply adjust the 'local Z position' of the 'Camera Target' gameobject (all the way in the controller's hierarchy: Root>CameraRoot>CameraControls>CameraTarget).

    And if you want to adjust the camera's distance while in-game, you could of course attach a simple C# script that changes the local Z position, based on user input (from the mouse wheel, for example).

    Hope this helps!
     
    Sunwer91 likes this.
  6. Sunwer91

    Sunwer91

    Joined:
    Jul 13, 2016
    Posts:
    5

    I will try it, thanks!
     
  7. JCardec

    JCardec

    Joined:
    Oct 26, 2015
    Posts:
    9
    Ok so, I see you made changes to your script causing it not to work. the problem is I'm using a custom controller script that used to work with the older version of your scripts but not with the latest version. when I use the jump function with my old script it no longer jumps. after going through the code I believe the problem lies within the OnGroundContactLost(), that seems to be it (tho self-thought coder over here, so not too sure). when I use the older version of the method it doesn't work. when I use the new version of the method, it's buggy in more ways than one. I don't want to redo my whole custom script to make it work, the easiest solution here is if you still have older version of your character package that I can re-import into my current project. the last time I posted on here was in april so it would be whatever version that you had back then. on the plus side lock-on and dashing still seems to work :)
     
  8. JanOtt

    JanOtt

    Joined:
    Apr 23, 2019
    Posts:
    180
    Hi!
    I think the fastest solution here would be for you to export the CMF files as a .unity package (i.e. a custom package) from a project that includes your older, modified version of CMF, then import that custom package into your new project.

    If that's not an option, you could also contact me directly and I'll see if I can find an older version of the asset.
    That said, the current/"newest" version of the asset was released on Apr 7, 2021, which seems to line up with your description - are you referring to an even earlier version?

    Best wishes,
    Jan
     
  9. JCardec

    JCardec

    Joined:
    Oct 26, 2015
    Posts:
    9
    went ahead and sent an email to support@j-ott.com <support@j-ott.com>; hopefully that's the correct one. Thanks for the cooperation!
     
  10. BrightBit

    BrightBit

    Joined:
    Jan 22, 2013
    Posts:
    240
    First of all: I love your character controller! I really do. Of all the controllers out there that I was able to get my hands on (e.g. Kinematic Character Controller, UFPS/Opsive, Realistic FPS Prefab, etc.), it's simply the best! It even works flawlessly with vehicle physics.

    However, your statement above regarding swimming makes me a bit sad. Disabling your controller and enabling another that handles swimming would make me lose all the advantages of your asset. You even use controller states internally already. Wouldn't it come naturally to just add another one for swimming?
     
    Last edited: Feb 6, 2023
  11. JanOtt

    JanOtt

    Joined:
    Apr 23, 2019
    Posts:
    180
    Maybe I haven't expressed this quite right earlier, but the idea was to create a dedicated controller script (not a different controller) that handles the velocity calculations when the character is in water - this script then passes the calculated velocity to the 'Mover' component.

    It might sound more straightforward, but using different controller scripts is just a lot simpler to implement and maintain. It also keeps the different "states" (regular movement, swimming, flying, etc.) separate, allowing for a modular workflow later on.

    For example, if you were to implement the swimming mechanics directly into the 'AdvancedWalkerController' script, you'd not only have to create a new controller state, but also make sure that every function and calculation inside the script takes that new state into account - which would bloat up the script considerably and probably introduce a ton of bugs that you would then need to fix one-by-one.

    Switching to a different controller script on the other hand allows you to start from a clean slate, without having to consider any other controller code that might run before or after (and potentially breaking existing code).

    I hope this helps explain it a bit!
    Best wishes,
    Jan
     
  12. BrightBit

    BrightBit

    Joined:
    Jan 22, 2013
    Posts:
    240
    Now I feel dumb. :) That actually sounds much more reasonable and it really didn't come to my mind. I will definitely try that. Thank you.
     
  13. ahmadriyandi

    ahmadriyandi

    Joined:
    Mar 22, 2020
    Posts:
    1
    hello, i want to ask about this package... how to specify ground layer? i can jump to my other character head and stand in there. how can i avoid this? and uh, it is possible to check ground without stick in it? just check
     
  14. JanOtt

    JanOtt

    Joined:
    Apr 23, 2019
    Posts:
    180
    Hi,

    The CMF controllers use Unity's built-in collision layer system, so you can simply use the collision matrix in the physics settings to change which layers the controller should be able to collide with.

    I'm not sure what you mean by "checking ground without sticking in it" specifically, though. Could you elaborate a bit?
     
  15. Karmate

    Karmate

    Joined:
    Aug 30, 2014
    Posts:
    42
    is it possible to use this controller with z axis long capsule collider ?