Third Person Controller character rotation issue

Fenda

Member
We're using the latest version of the Third Person Controller. With the Adventure view and movement type, the character moves forward when we strafe left or right. This is due to the character rotating in a sort of "arc" as can be seen in this GIF:
ezgif.com-optimize.gif

Changing the Motor Rotation Speed to 1 kind of fixes the issue but then the rotation of the character snaps immediately with no lerping so it looks pretty bad.
The RPG movement type doesn't seem to have this issue (if Previous Acceleration Influence is set to 0), but we are looking to use the Adventure type as it fits our game best.

This is a GIF from the Unity starter assets pack for their third person controller. Here you can see the character moves on the spot when hitting the strafe keys but still has a turning rotational lerp.
fix.gif

Any pointers on how to address this would be much appreciated.
 
With the adventure movement and view type the character moves as you'd expect in a fresh project. It sounds like you may be using root motion rotation which would likely cause that issue. Make sure you are not using this setting for regular locomotion unless you have animations specifically designed for that.
 
With the adventure movement and view type the character moves as you'd expect in a fresh project. It sounds like you may be using root motion rotation which would likely cause that issue. Make sure you are not using this setting for regular locomotion unless you have animations specifically designed for that.
Hey Justin! We don't have root motion enabled on the character and our animations are in place. How can we go about getting the character to turn without moving in an arc?
 
I haven't seen that happen before so I'm not sure the cause. Have you tried a fresh project?
 
I haven't seen that happen before so I'm not sure the cause. Have you tried a fresh project?
You're not seeing it happen in the demo scene? I've seen there's another post here on the forum about it from a while back but there wasn't really a resolution found then either:
 
No, I'm not. In the build that was made with 3.0.16 I don't see it either: https://opsive.com/wp-content/uploads/2022/10/UltimateCharacterControllerWindowsDemo.zip. By default the adventure view/movement type is used.

If it appears in that demo executable then it's probably related to your input. In this situation I recommend using the Rewired or Input System integration.

That's strange. Both myself and someone with a different PC have just verified that the bug happens in that standalone demo too. We are simply just alternating the strafe left/right (A/D) inputs and the character moves forward gradually over time. I'm pretty sure its not an issue with input on our machines (several other people noticed this behaviour in our recent playtest). Here is a video demonstrating it.


On our own project we use Rewired input and the issue is still there so that doesn't fix it either.
 
Oh, I misunderstood what you were mentioning.

The reason that exists is because of the root motion animations. If you don't use root motion then the locomotion will move precisely left and right.
 
Oh, I misunderstood what you were mentioning.

The reason that exists is because of the root motion animations. If you don't use root motion then the locomotion will move precisely left and right.
I just installed 3.0.16 to a fresh Unity project and tried the demo scene with Use Root Motion Position both on or off and it happens in both cases. Is there something else I need to do to disable the root motion if that's what the issue is?

Here is a video demonstrating with setting either on/off:
 
What is your rotation speed set at? The top down area provides a great example of the character going back and forth without any movement. In that zone the rotation speed is set at 6.

The forward movement is coming from when the character rotates. The Adventure Movement Type is using the character's forward direction to determine which way to move. If it's a slower rotation then you will get the character moving forward some relative to the camera.

There isn't an option in the Adventure Movement Type to eliminate this. I can add it to my request list, but it'll take subclassing the Adventure Movement Type.
 
What is your rotation speed set at? The top down area provides a great example of the character going back and forth without any movement. In that zone the rotation speed is set at 6.

The forward movement is coming from when the character rotates. The Adventure Movement Type is using the character's forward direction to determine which way to move. If it's a slower rotation then you will get the character moving forward some relative to the camera.

There isn't an option in the Adventure Movement Type to eliminate this. I can add it to my request list, but it'll take subclassing the Adventure Movement Type.
With a high motor rotation you end up with a super snappy movement that looks glitchy. A smooth rotation (on the spot) would be better, as shown in the GIF in my original post.

We'd be happy to write a subclass for the Adventure movement type but do you have any tips on what we'd need to write? Adventure is perfect, except for this one thing that makes it feel a bit janky.
 
Ok - we fixed it by subclassing Adventure and using the GetInputVector from TopDown with Previous Acceleration Influence set to 0.

C#:
using UnityEngine;
using Opsive.UltimateCharacterController.Utility;
using Opsive.UltimateCharacterController.ThirdPersonController.Character.MovementTypes;

public class LasersAdventure : Adventure {
    // Borrows from TopDown.cs
    public override Vector2 GetInputVector(Vector2 inputVector) {
        var rotation = m_CharacterLocomotion.Rotation;
        // The camera may not exist (in the case of an AI agent) but if it does move relative to the camera position.
        if (m_LookSource != null) {
            var localEuler = MathUtility.InverseTransformQuaternion(Quaternion.LookRotation(Vector3.forward, m_CharacterLocomotion.Up), m_LookSource.Transform.rotation).eulerAngles;
            localEuler.x = localEuler.z = 0;
            localEuler.y = 360 - localEuler.y;
            rotation *= Quaternion.Euler(localEuler);
        }
        // Convert to a local input vector. Vector3s are required for the correct calculation.
        var localInputVector = Vector3.zero;
        localInputVector.Set(inputVector.x, 0, inputVector.y);
        localInputVector = Quaternion.Inverse(rotation) * localInputVector;

        // Store the max input vector value so it can be normalized before being returned.
        inputVector.x = localInputVector.x;
        inputVector.y = localInputVector.z;
        // Normalize the input vector to prevent the diagonals from moving faster.
        inputVector = Vector2.ClampMagnitude(inputVector, 1f);

        return inputVector;
    }
}
 
Awesome, thanks for sharing your changes! It'll make it quicker to add to the next update.
 
Awesome, thanks for sharing your changes! It'll make it quicker to add to the next update.
No worries! Maybe a bool on Adventure for this behaviour rather than a separate movement type would be useful. But i'll leave it to you! Thanks for the help Justin.
 
Top