Forum rules - please read before posting.

Sprites Unity Complex not returning a changing Direction int

Hi :)

Ok, so I have a player, with Sprites Unity Complex for the animations (it's connected up with Spine2D/McMenamin controller).  I have Direction Int set to "Direction" and when I start the scene up, the correct animator sees the direction and changes it to "3".  But... it never changes out of 3 even if I click around in other directions.  I don't have any scripts that update Direction, only retrieve it.  Here's a gif of the weird behavior/set up:
image


(Also I managed to check a box somewhere that made everything pixelated? I'm sure I'll find and uncheck it by the time you have a chance to reply.. but just in case, do you know where that mystery checkbox lives?)

Thank you so much :x

- Mo

Comments

  • AC doesn't have a "pixelate" option, but it's possible that you're referring to the zoomed-in Game window.  Move the slider at the top to 1 if so.

    Which version of AC are you using?  Though your scripts only read the value, as you are also using Spine test AC on its own without anything else - just so that we can isolate this as an AC issue.

    The 2D Demo's Resources includes a Sprites Unity Complex variant of the Brain2D player.  Try dropping him in and see if that works for you - you'll need to add a Direction parameter / name into the text box, but it all works fine for me.  If it works for you as well, the issue will be specific to your character - in which case, let's see some more detail about your character.  Where is your Animator component located?  Is it just the one?
  • Hi MoCohen,

    I am also using Spine with AC. Make sure you assigned the Mecanim controller to the Spine Object.
  • Whoops yeah I was zoomed in :)  thank you for the quick reply!

    Using AC 1.56b and Unity 5.5.2

    The Brain2D Sprites Unity Complex worked, thanks for the suggestion :)

    From comparing mine with the working version, I've narrowed it down to something regarding the "turn speed".  I had it set to 0 to keep from squishing the sprite all funny, but then the direction int never changes.  Is there a way to disable turning?  If I have a value in the turn speed it tracks direction just fine.

    Thank you both again :)
  • A character has to turn in order to properly navigate a scene.  The root object itself will actually rotate in 3D space, but the assigned sprite child will counter-rotate every frame so that it always faces the camera (hence the need for it).

    Have you properly assigned your sprite child?  Again, you can refer to the Brain2D prefab on how a sprite should be attached to the root object.
  • Hm, only difference is that instead of a Sprite renderer I'm using Spine2D (Meshes).  Here's a gif of the weird squishing behavior:

    image

  • This might help narrow it down... when I change my player's Sprite to the one from Brain2D sprites unity complex, I get a similar looking issue.. so it's probably with how I set up my player? But my player looks the same... I'm gonna try to re-create it I think:

    image
  • Check that you aren't keying your sprite's rotation as part of its animation set.  AC needs to set the rotation of the sprite child itself - but if you're overriding it through animation then it'll cause problems like the one you're experiencing.
  • Hm, how can I check that? I disabled all custom scripts attached to my player so it's just Spine2D files and the player setup. here's pics of my set up (also thank you for helping me troubleshoot through this!! I might just try to write a script to determine direction if I can't figure out what's going on here...) The one weird thing (to me) is in the Rigidbody the Z axis gets frozen on start, but it happens to Brain2D also so I guess it's expected?:

    Player:
    image
    image
    image

    Animator attached as a child object to player (buncha Spine2D stuff,):
    image
  • A Rigidbody2D isn't necessary unless you want collisions or the use of a Hotspot Detector, so you may want to test out disabling it.

    However, my point about the animation clips themselves - if you open up the Animation window and view the animations present in your Animator, you can see if the rotation of the sprite child is being keyed.
  • If the Animator must control its own transforms rotation, one option would be to create an a new GameObject between the root and the sprite/Animator in the Hierarchy, and set that as the "sprite child".

    The sprite child itself must currently have an Animator, but I shall remove this limitation in the next release: if a sprite child is assigned yet has no Animator, a new field will appear to let you manually assign one.
  • Weiiird, so, inspecting the Player and the SpriteAnimator and the SpriteChild (the extra layer you suggested), none of their z transforms move at all even though the image is definitely rotating on the z axis (regardless of which is set at the Player's Animatior).  I'm not sure if Spine messes how the animation tab works, but I'm not seeing much info in there:

    image
  • Phew! Ok, so Spine2D doesn't uh bake animations so they don't show in the animation tab.

    But I found a solution! Er well I got it working, but I don't know *how* still.  But since I only need to create one player I won't worry too much about the how.  I ended up working backwards from the Brain2D example, slowly swapping out the animator, sprite, etc for my spine set up, and it detects direction without messing with the z axis :) Thank you again so much for replying so quick and helping me troubleshoot!
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.