Forum rules - please read before posting.

Direct Mouse & Keyboard Movement Limitation - No Limit turning gradually

Hello,

While running/walking and then turning its fine,

However, while idle/stand still and then turning, the character does a 90 degree turn.
The gameplay I am attempting to accomplish is that the character would turn gradually, for example by 10 degree increments, similarly to while running/walking and turning.

Is there a hack or some other options that we can add to make this possible please?

It is very imperative that I have this work smoothly

Thank you

Comments

  • When you say a 90 degree turn, you mean instantly?  Make sure you don't have Turn instantly when under player control? checked in the Settings Manager.

    Otherwise, if all you mean is you want the Turn speed to be lower when standing, you can do that through script:

    void Update ()
    {
      if (KickStarter.player.GetMoveSpeed () < 0.1f)
      {
        // Standing still, lower turn speed
        KickStarter.player.turnSpeed = 2f;
      }
      else
      {
        // Moving, raise turn speed
        KickStarter.player.turnSpeed = 5f;
      }
    }
  • Thank you that is useful,

    I used it to  debug the speed and figure out where the difference is.

    So, if I just press the A- or D once the character does the 90 degree turn I was referring to, if I hold the A or D the character does turn with the same speed as when running/ walking, I guess what I am attempting to change is when its at stand still and A or D is pressed to only rotate a bit rather than the whole 90 degree.

    I checked and Turn instantly is unchecked in the settings manager,

    If you can please help me out with the script to control this turn that would be great,

    Thanks again
  • It might need tweaking to get the exact behaviour you want, but this should do it.
  • Ah I see what you did there, makes sense.

    The character now only turns a small amount when A/D pressed, this with a combination of the other script you provided can be used in conjunction to make it as slow/fast as needed,

    Out of performance question, will this be ideal to remain in an update function rather than to have an option somewhere in your character movement such as turn instantly, to turn gradually? Just curious,

    Thank you very much for your help.
  • With the tweaks you want to make, it's best left as a custom script.  I wouldn't worry about the performance impact of a single Update() function, though.
  • Sounds good thank you
  • Hi Chris!

    The link above is not working now and I have same issue with only 90 degree turn as kici said.

    Can you please send me the script to tweak character turning? I assume I add the script to the character?

    Thanks,
    Jakub

  • Apologies, but I don't believe I still have it. Perhaps @kici still does?

  • I will ask him, thanks.

  • I will share it once I'm back home. Just travelling now, should be back Wednesday.
  • OK, looking forward @kici .

  • @jakub I've actually tweaked a lot in my script, but I believe the part you are looking for is this:

        private void LateUpdate ()
        {
            if (KickStarter.player.IsReversing ())
            {
                KickStarter.player.runSpeedScale = KickStarter.player.walkSpeedScale;
            }
            else
            {
                KickStarter.player.runSpeedScale = normalRunSpeed;
            }
        } 
    

    Of course you can change the isReversing to KickStarter.player.GetMoveSpeed () < 0.1f or whatever it is you are trying to achieve.

    The other thing in my script changes is when player reversing and turning I have the axis reverted so it gives the natural reverse turn, according to my standards lol.

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.