Forum rules - please read before posting.

Character Movement Fundamentals integration

Hi there! I am still trying to set up a nice character controller, this time it's not UFPS but CMF (https://assetstore.unity.com/packages/tools/physics/character-movement-fundamentals-144966#reviews). I am working on a first person controller.

With help of the developer of the asset I was able to set everything up how I like it (AC controls the mouse and camera rotation and CMF moves the player). I identified a problem with custom gravity ("GravityFlippers" that rotate the gravity 90 degree, like in this video: https://tmpsend.com/nQ0dG3ZZ):

  1. When using the CMF controller that is set up as above and with AC's Player-Component, the following happens: https://tmpsend.com/UkxSbhv0 (the character flips 90 degree on the y-axis and not on the z-axis)

  2. When removing the Player Component for test purposes, the flip works (obviously this is no solution, because all AC stuff is missing and the camera can't be rotated).

I am looking for a pointer where to change the Player script to let me use AC while also being able to use those gravity changes. I suspect public Transform FirstPersonCamera to be the culprit, but I don't know enough about AC and Unity to be sure.

I hope I explained the situation good enough. If you need additional info or screenshot, I will provide them. Could you please point me in the right direction here if you got any idea?

Thanks!

Comments

  • When using AC's built-in First Person movement, mouse input on the X-axis rotates the Player's transform, while input on the Y-axis rotates the camera's pitch. Essentially you've got two separate transforms to deal with.

    The First Person camera's pitch is affected locally, but AC assumes that the Player's up-vector matches the world up axis. If you want to try hacking AC directly, the rotation is set not within the Player script but PlayerMovement's FirstPersonControlPlayer function:

    Quaternion rot = Quaternion.AngleAxis (rotationX, Vector3.up);
    

    Does CMF have its own First Person camera? If possible, I'd suggest foregoing AC's own First Person movement in favour of that, since it'd be best to have a single asset be responsible for all of the Player's motion.

    If you set the Player Inspector's Motion control field to Manual, then AC will not affect its Transform values.

  • edited December 2022

    Thanks for all the info!

    CMF has its own first person camera and camera control. I tried just attaching the Player component (Motion Control := Manual) to the CMF character controller (as set up in their original asset; including camera and camera controls), but two things happened:

    1. Camera movement got weird: x axis rotation (left-right) is way more sensitive, y axis rotation (up-down) way less sensitive. Very hard to control the character this way.

    2. The behaviour when using the gravity flippers (the triggers described in my first post) stay the same (no gravity flip, but a flip along the y axis).

    Shouldn't setting Motion Control to Manual prevent AC from changing anything related to motion? Does AC still control/influence Player's rotation even when using manual motion control?

    These are the settings for the Player component:

    https://imgur.com/a/KeDn1Qt

    This is all very new to me, thanks for answering!

  • Does AC still control/influence Player's rotation even when using manual motion control?

    Shouldn't do - have you removed AC's First Person Camera component as well?

    Set the Settings Manager's Movement method to None, and attach a Basic Camera component to the CMF First Person Camera child object - that'll mean you can then assign it as either your Scene Manager's Default camera property, or switch to it via the Camera: Switch Action.

    If you still have an issue, temporarily remove the Player component so that AC has no control over it at all, and check that the CMF motion is correct without it.

  • Hi Chris, thanks again for the fast and helpful answer!

    After following your advice and setting the Movement Method to None and adding the Basic Camera component to the camera, the movement works as expected. Thanks for the hint!

    I start to grasp AC's main principles more and more. Thanks for being patient!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.