Forum rules - please read before posting.

Movement of The Player

Greetings!

I noticed that the player is not moving accurately in every direction, it feels like it goes either up, down, left or right.. but if I wanted to move the character towards a 30 degree angle it gives me a hard time. and I made sure to set the -Movement limitation- to "No limits", and unchecked "turn instantly when under the player's control". I don't know if I explained the situation well, but I hope you guys get the point.. Maybe there is something inside the player's script that I can change, like a float or something so I can turn around in every direction more slowly and accurate..?

Comments

  • 2D or 3D? I'm assuming you're using Direct control. Is this with the keyboard or a controller? And what are your AC/Unity version numbers?

    A video or at least screenshot would help explain the issue, because pressing in an e.g. up-right direction should cause diagonal movement - or at least not completely up or completely right. Please also share images of your Player's full Inspector.

    Does the Account for player's position on screen? property make a difference?

  • edited August 2019

    -3D
    -I'm using Direct control
    - I'm using controller
    - AC version latest/Unity version 2019.1

    Does the Account for player's position on screen? property make a difference?

    No

    pressing in an e.g. up-right direction should cause diagonal movement - or at least not completely up or completely right

    That's the main problem I'm having, because as you said its not completely up or completely down but it's also not so accurate and as I said it gives me hard time when I try to position my player to face a certain diagonal direction.
    Here is a video to help show my problem more. :)
    https://youtube.com/watch?v=DI35Xj963JQ

    -

    Here is my player's inspector.

  • Full Inspector, please - non-AC components included.

    We'll have to do some tests to try to isolate the source of the issue. Start by disabling root motion and the Animator itself, and use AC for full motion control.

    What then? If things are still problematic, it may be related to your input settings - so let's see the Horizontal and Vertical inputs you have defined.

    If things are better, it may be a root motion issue - in which case please share more details on how your Animator is set up.

  • Start by disabling root motion and the Animator itself, and use AC for full motion control

    I disabled the root motion and turned off the animator,
    I used only AC Player component to move the player, but the problem still remains. Therefore, I believe its not an animator issue since I turned it off completely.

    let's see the Horizontal and Vertical inputs you have defined.

  • When I switched the "direct movement type" to "Tank controls" I can accurately turn the player towards any angle just like I wanted, but I don't want to use tank controls option..

  • The motion in the video suggests it's a sensitivity issue with the controller. Using the same input settings, however, on a similarly-set-up character on my end causes no issue. Due to differences in controller type (I'm testing with a PS4 pad) though, it may be worth playing with the Sensitivity settings.

    Keeping the animation disabled, how about if you replace both the Rigidbody and Capsule Collider with a Character Controller? Are you relying on any non-AC scripts for e.g. the camera?

    Let's try some debugging. Open up Char.cs, and find the SetLookDirection function (around line 1689). Find the following:

    lookDirection = new Vector3 (_direction.x, 0f, _direction.z);
    

    and insert beneath it:

    Debug.Log (name + " lookDirection: " + lookDirection);
    

    Disable Collapse in the Console window and keep it open when testing. Does the listed vector match the direction the player moves in?

  • I tried playing with the sensitivity, it kinda made it a bit smoother, but still there is like a gab between each direction, for example its either 180, 90 or 30 degree, you can't go 35, 40, or 50 degree in-between.. I don't know if you get what i'm saying. :D
    For the capsule collider and character controller it doesn't make any difference.

    Are you relying on any non-AC scripts for e.g. the camera?

    I'm using pure AC.

    I think I kind of figured it out with the debug log. As I said it goes with a big move either 0.5, 0, or -0.5, so maybe there is a value inside the character script that we could modify to make the movement more precise, like instead of it goes from 0 to 0.5 it could be from 0 to 0.1 then 0.2 and so on. :)

  • I don't know if you get what i'm saying

    I do, but I cannot get such behaviour to occur on my end.

    I think I kind of figured it out with the debug log.

    Please share a sample log statement, including the stacktrace that appears beneath.

    Let's try another Debug.Log. Remove the last one, and this time find the CreateMoveKeys function in PlayerInput.cs.

    If you're not limiting direction, find the last line in the function:

    return new Vector2 (h, v);
    

    And insert the following just above it:

    Debug.Log ("Input: " + new Vector2 (h, v) + " vs " + new Vector2 (Input.GetAxis ("Horizontal"), Input.GetAxis ("Vertical")));
    

    How does that compare? Do the values left and right of the "vs" match up, or are they different?

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.