Search Unity

Player Controller won't turn on other PCs

Discussion in 'Physics' started by Solid_Edgy, May 21, 2020.

  1. Solid_Edgy

    Solid_Edgy

    Joined:
    May 12, 2019
    Posts:
    7
    I've got a problem with my player controller I am using this code to rotate it:

    Code (CSharp):
    1.            if (thisRB.velocity.magnitude < 1)
    2.                rotMultiplier = thisRB.velocity.magnitude * 0.1f;
    3.  
    4.            //calculating the forward velocity - if it's negative the controls should "inverse" when going backwards
    5.            Vector3 localVelocity = transform.InverseTransformDirection(thisRB.velocity);
    6.            if (localVelocity.z > 0 || inputY > 0)
    7.                rotMultiplier = Mathf.Abs(rotMultiplier);
    8.            else if (localVelocity.z < 0 || inputY < 0)
    9.                rotMultiplier *= -1;
    10.            thisRB.AddRelativeTorque(transform.up * thisRB.angularDrag * rotMultiplier * inputX);


    On my Pc it works completely fine. I've created a build and tested in on my laptop: This is where the problem occurs: The player can't rotate. Or to be specific - the rotation speed seems to be just way too small to be noticeable.

    It doesn't seem to be caused by the low end laptop as turning doesn't work on a friends high end PC either.
    (When trying it on another friends laptop and a PC it works.)
    What's even more confusing to me is that the ML Agent (That is deriving from the same base class as the player!) is able to turn just fine on the PCs where the player ISNT able to turn.


    I've tried multiplying it by time.deltatime - still the same problem. I've also tried it with time.fixeddeltatime ... yea. Same problem.

    I'm out of ideas how to fix it at this point as there is no observable consistency to it - it doesn't seem to be tied to the framerate.


    This is the entire base class if anyone needs it: https://hatebin.com/ikmfdwlozj
    The deriving class the player is using: https://hatebin.com/enbthwigjo
    The deriving class the ML Agents are using: https://hatebin.com/wkyycnqovr

    How is the ML Agent able to turn but not the player? Is this possibly a bug, if not - what would be a possible solution