After trying to solve it on my own for a full day and failing, I need help! (I'm a newbie)
What is the correct method of using an Anima2D character in Adventure Creator?
I'm trying to make a scene/ game purely in 2D (with "I'll position my characters in 3D space" selected, which I think = screen space option in moving and turning) I'm using Direct method for movement
Question 1: What is the main advantage of positioning in 3D space? I'm trying to create a game that looks like Night in the Woods, with only left and right movements, and I feel this would give a better look (but I'm not sure why)
I plan to have dynamic lighting (probably with the 2DDL asset) If there isn't much of a difference, then I might as well stick with the Unity 2D option for Moving and turning, and avoid a lot of confusion that screenspace brings (such as needing navmesh instead of navmesh 2D)
I have created a character and rigged and animated it in Anima2D, and then turned it into a prefab. I then brought it into my 2D with screenspace scene, and tagged it as player (layer ignore raycast, including components such as animator, rigidbody, capsule collider and player) I've given it an animation engine of Sprites Unity Complex.
Question 2: For an Anima2D character that is to be used purely in 2D, am I supposed to set it as a Sprites unity complex? Am I supposed to give it 3D components instead of 2D components? (I would like to avoid 3D if it isn't necessary for what I want - a purely 2D game)
I followed the text tutorial on the AC website for Making a Mechanim based character, including the part with the parameters and transitions. Is this necessary for an Anima2D character? After this, the character moves very slowly, starts walking much after pressing a direction key, and begins to run randomly (not depending on pressing the shift key)
I've probably made a mess of multiple settings that don't go together.
Here are my player inspector settings :
Thanks in advance!
Comments
You're correct about the effect of the "I'll position my characters in 3D space" option. Screen Space mode basically means that characters move in 3D (i.e. towards and away from the camera) rather than purely along the X/Y plane. Unlike the World Space option, it still relies on 2D components, meaning you can still place Hotspots etc down in the 2D window. It's main use is for when you want true depth as opposed to the faking effect caused by the Sorting Map system in "normal" 2D games.
This allows for other neat things, such as placing 3D meshes in the scene that the characters can move around. However, similar behaviour can be achieved by using 2D characters and 2D cameras in a 3D scene.
I would suggest you stick to Unity 2D mode, unless you have a specific need for otherwise - for the same hassle you've mentioned above. As an additional, I'm currently revisiting these extra "Moving and turning" options as I'm not sure how relevant they are today - they were chiefly added as an interim way back before Unity implemented their own 2D mode. Happy to take feedback regarding this, however.
You would need 3D components for this mode, as moving around 3D space requires 3D collisions. 3D components should indeed work with 2D-animated characters - dropping the Brain2D player prefab into the 3D Demo scene should generally work so far as moving around goes. However, again unless there's a real need to, I would suggest sticking to purely 2D components. The Character Wizard can help you modify your starting sprite with the correct components / hierarchy.
So far as Anima2D goes, you'd definitely want to rely on Sprites Unity Complex mode, as Anima2D requires the use of an Animator Controller to work. There was a recent discussion on using Anima2D in AC here, which you may want to consult.
Root Player object
- Rig
A BlendTree can accept parameters that go beyond 0 -> 1 by unchecking "Automate Thresholds".
AC will only control one Animator - and if there's one on the sprite child, then that will take precedence over the base one.
You shouldn't have to rely on two separate animators, however. You can instead use layers - place the flipping in a base layer, with the standard animations in the next layer down. You also shouldn't be animating the root at all - that's why a sprite child is necessary.
What is your actual flipping animation, and what are the transitions to it? Those are not clear in the screenshots you've posted.
http://pasteall.org/476288/csharp
Attach it to your character and fill in the fields. You'll need to make sure your Animator still covers all angles - in the case of the included example character, all the "R" animations would be set to their "L" counterparts.
If succesful, I'll consider incorporating it into the official release.
The location of the component is not important - the Character field should be assigned as your Player's root, and the "Transform to flip" should generally be your sprite child.
When set to Left To Right, the character will flip when facing left - meaning you can have all right-facing animations since they'll be inverted when appropriate. Vice-versa for Right To Left.
The script does not refer to animations by name - I just mean that your character's controller should still be set up for all angles. If you only have right-facing animations, then the Animator should be set up to play these right-facing animations when the character is facing left (i.e. the Angle float is >0, <180).
You can test it with the included Brain2D_SpritesUnityComplex example by opening each of the Idle, Walk and Talk BlendTrees and replacing each "_L" animation with its "_R" counterpart.