Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

1.52 bug? Motion controller stuck

Hey there,

I upgraded from 1.51f to 1.52, and after that I've had a problem with my motion controller.

I use Unity's standard 2D character controller for movement, and it has always worked fine with AC, but with 1.52 when I press a directional button it plays the walking/running animation like normal, but the character doesn't move, he's stuck in place.

I hope I captured all the relevant inspectors/scripts, let me know if more info is needed.

imageimageimageimage

Comments

  • Nothing about v1.52 comes to mind.  But your Link script calls Move in Update, while the Control script calls it in FixedUpdate.

    Use Debug.Log to check that the "h" float in Controls' FixedUpdate is being set correctly, and that Link's Update is not calling Move when it shouldn't be.
  • Yeah I didn't see anything in the changelog either that could be related, so it's weird.

    I tried the Debug Logs but I saw nothing out of the ordinary there. I tried reverting the motion controller scripts to their default and tinkered with some rigidbody settings and all, but nothing seems to unblock the movement, apart from switching the Player script motion control back to Automatic (but that gives really weird results).

    It's no biggie to revert back to 1.51, I don't use many of AC's features in this project.
  • Setting it to Automatic will cause AC to control the movement at the same time as PlatformerCharacter2D, so wierd results would be expected.

    It's not clear if this issue would affect other custom controllers, so I would like to investiage it even if reverting to v1.51 is an option.  Could you take the Brain2D player prefab and convert it so that it makes use of this system?  You could then send it to me (prefab + scripts) as a .unitypackage so that I can check it out.
  • True, you're right of course, it might not be a problem for me now here, but it might for future projects or other people.

    I put the files into this here package. It's basically the converted Brain2D prefab, my AC link script and the contents of Unity's 2D package which has the motion controller I use. I modified the Platformer2DUserControl and PlatformerCharacter2D scripts in there for my method.

    That folder also includes Unity's RobotBoy prefab which uses my same control method but operates outside of AC. That one moves okay, but Brain doesn't. I can see him turning just like my own player, but no movement.

    The animations on Robot Boy and Brain2D aren't hooked up right, by the way, but that shouldn't matter. (Long story short, I send variables to the animator which triggers the animations for my own player prefab, but of course those don't exist on the other characters.)
  • Downloaded, thank you - I'll shout if I need anything else.
  • Found.  Open up Char.cs, and find the function named MoveRigidbody ().  Above all other code in that function, paste in the following:

    if (GetMotionControl () == MotionControl.Manual || GetMotionControl () == MotionControl.JustTurning)
    {
      return;
    }

  • Yep, confirmed fix. Thanks!
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.
Do NOT follow this link or you will be banned from the site!