Forum rules - please read before posting.

3D Character only moves in one direction - need help diagnosing the problem

I'm new to both Unity and Adventure Creator. I've set up a 3D player character (using 2D sprites) in what I think is the correct way, but all the movement keys move it in the same direction. I've checked the Unity input settings and they're as you'd expect.

Comments

  • edited May 2024

    Welcome to the community, @eldomtom2. What are your AC and Unity versions?

    Which direction does the character move in? Is it always literally in the same direction (e.g. right), or just on the same axis (e.g. left and right)?

    To be clear: you're working with 3D characters that use 2D graphics - is that to say yours is a 3D scene? Check that the Settings Manager's Camera perspective setting is set to 3D.

    We can help determine if this is an issue with your Player, or the wider settings, by temporarily relying on a separate 3D Player. If you navigate to /Assets/AdventureCreator/Demo/Resources in the Project folder, you'll find "Tin Pot" - the 3D Player used by the 3D Demo. Drop them into the Hierarchy while in Edit mode, and they'll override your default one assigned in the Settings Manager at runtime. Does Tin Pot have the same issue?

    If you can share some full-screen screenshots of your situation (including the game when running, the Settings Manager and your Inputs), I'll see if I can spot the issue.

  • Tin Pot controls fine. My character always moves literally in the same direction. The camera perspective is correctly set to 3D. I have attached some images - I believe these cover all of the relevant info.


  • edited May 2024

    Please let me know your AC/Unity versions.

    The screenshots only show a portion of the Player's full Inspector, but this may be a case of them having no "sprite child" assigned.

    Does the character's Animator have "Apply Root Motion" unchecked?

    Move the character's sprites/animation to a child object of the root, and assign this as the character's "Sprite child" Transform field. The 2D Demo's Player prefab, Brain2D, demonstrates this setup.

    That may be enough, but if not: doing this step should then reveal a Turn root object in 3D? field in their Inspector's "Movement" panel. Try toggling this value.

  • It only works if I turn "Turn root object in 3D?" on. Also by making the sprite a child object of the player prefab there are now two sprites, neither of which animate - one turns in response to movement and the other always faces the camera. I think Apply Root Motion is turned off because I remember checking that it was but I can't find it now.

    I'm using Unity 2022.3.30f1 and Adventure Creator v1.81.0.

  • Turn root object in 3D? will need to be enabled if your character is in 3D space - keep it like this.

    If you're getting multiple sprites, make sure you only have one set of sprites on the character. After adding a Sprite Renderer to the Sprite Child, you can now remove the Sprite Renderer from the Player's root - and the same goes for the Animator.

    I can only speak generally without seeing details of your Player's Hierarchy, however. If you can share full-screen screenshots of your Player's full root, and sprite child Inspectors, I can see about giving more specific advice.

  • This is my character's hierachy. If I delete the sprite from this the Sprite child says "missing" and I get the "only moves in one direction" issue.

  • edited May 2024

    Don't delete the sprite from the Sprite child - that's where it should be.

    Do you also have a sprite, and Animator, on the root object, BB-Player? They'll be the duplicates that need removing.

    To know what you're working with exactly, it's the Inspector of the BB-Player and bb-stand-1 objects that I'd need to see. If the above doesn't solve it, share screens of those and I'll see if I can spot the issue from those.

  • Ah, I realised what you're saying. You want me to disable the sprite renderer component on the BB-Player root object and add an Animator component to the bb-stand-1 sprite object. I did that and now everything seems to be working fine. Thanks a lot for your patience and help.

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.