Forum rules - please read before posting.

3d characters on 2d backgrounds

Perhaps it has been spoken so much but I think it would be a good idea to improve the use of 3D characters in 2D backgrounds.
I do not really know if this is possible.
Many of us would love to use 3D characters rather than Sprites to improve fluidity and because once animation is created, such as the character that gathers something, animation can be used in every direction without having to create more animations with sprites.
But all this with the ease of use of 2D components, without having to place objects in 3D space, or using hotspots with polygon colliders, or even using a 2D navmesh ...
Currently, if I understand well through my tests, there are several issues like order in layers, walking in only eight directions, vertical walking, resize when the character moves away, and so on.
It would be really wonderful to be able to develop a game under these conditions.
If this was not possible, at least improve this approach as much as possible.
Thanks to Chris for his wonderful job.

Comments

  • edited September 2017
    I agree that it should be a viable option, and am open to specific suggestions.  However, try it in the latest release.  Improvements were made to exactly this area.  What tests have you done, exactly, and in what version?

    You can already use 3D characters in 2D backgrounds - the 3D Demo game's character can be dropped into the 2D Demo and it will still work.  A Follow Sorting Map component can be attached to the model, and it will scale the 3D character as it would a 2D one.  But again - that's in the latest release.

    The key issue with 2D/3D mixing is that of the layer ordering, i.e. getting models and sprites to display correctly relative to one another, properly taking their "order" fields into account.  This, however, is a Unity issue - not an AC one.  AC is not a graphics tool, but instead relies on Unity's rendering system.  AC is able to modify the renderer components "order" values, but it is up to the shader being used to make use of them.
  • edited September 2017

    I was waiting for the latest release, I had read that you had improved some aspects in this regard. Strangely I did not get Unity's notice, I was working with 1.59.
    Yes, now with 1.59a the character scaling works.
    By eliminating Rigidbody and Capsule Collider and removing the Apply Root Motion check (modifying the parameters of Animator Controller) character moves and resizes.
    Assigning to the Z field of Position the value of -1 the character remains in the foreground.
    There are, however, two main problems.
    In the UP and DOWN direction the character does not walk but slides, I guess because it is not in 3D space motion and is interpreted as vertical.
    I think I have read that this movement needs to be included in the Animator Controller, is it true?
    Another issue is that the character only moves in eight directions and this is terrible to see. In this case there are no solutions, right? This is very important for me, if the pure 2D does not allow 360 degree movements, I'm forced to work on the 2.5D mode or 2D Screen Space.
    What can you tell me?


  • edited September 2017
    I've recreated the issue of vertical movement not causing characters to animate walking - I'll remedy that in the next release.

    As for walking in 8-directions, I don't understand where that's coming from.  Characters that have sprite-based animation engines (which your 3D character shouldn't be using) can limit animation to 8-directions, but even this does not affect movement.

    What's your Movement method set to?  I don't have that problem with the 2D Demo and Tin Pot - how does that behave on your end?
  • edited September 2017
    You're making me doubt.
    I just tried it and my feeling, compared to the movement in screen space, seems to me in eight directions.
    Is it an optical effect? Can you try in your 2D demo but using the Girl of the 2.5D demo?
    Really, TinPot would seem to move properly but could it be because we do not see the leg animation?
    If I use the Girl instead of TinPot, by removing Apply Root Motion and increasing walking speed in Animator Controller and even eliminating RigidBody and Capsule Collider components, the character seems to go sideways when the click is not in one of eight directions.
    Movement method is Point and Click.
  • I can't see a movent issue with the girl.  Try it with Gizmos enabled in the Game window - a blue line should depict the player's path.

    If you're not using Root Motion, then character movement and animation should be independent.

    To be absolutely clear: are you talking about the actual movement of the character, or their facing direction?
  • edited September 2017
    Sorry, you are absolutely right, I badly explained myself, I do not mean the character's movement, who goes exactly to the point of the click, but to its facing direction.
    If we assume UP = 0 degrees, if we click at 100 degrees the character's facing direction is 90 degrees. This can not be solved because of 2D?
    As for the Root Motion it is not my choice, if I leave it enabled Girl does not move, I have to turn it off, and in this case the walking speed decreases considerably and I have to increase the parameters of  controller.
    TinPot has Apply Root Motion disabled by default. 
    Perhaps I have forgotten some option to leave Root Motion turn on?

  • edited September 2017
    If we assume UP = 0 degrees, if we click at 100 degrees the character's
    facing direction is 90 degrees. This can not be solved because of 2D?

    Is that showing exactly as 90 in the Inspector? Generally speaking, a character's facing direction is directly tied to their movement direction - there's nothing in AC's code to "snap" facing directions to arbitrary rotations.

    I wonder if this is a visual issue, since this involves 3D rotations based on a 2D trajectory.  It might be that this is due to the nature of the mode: a flat 2D perspective effectively simulating 3D.  Try changing the camera's Projection to Perspective, and assigning a low Vertical movement factor in the Scene Manager - any improvement?

    As for the Root Motion it is not my choice, if I leave it enabled Girl does not move, I have to turn it off, and in this case the walking speed decreases considerably and I have to increase the parameters of controller.

    Root Motion will need to be off in a 2D game, even if 3D characters are involved.  The Girl is designed to work with Root Motion in a 3D scene, so if Root Motion is disabled it will slow her down, of course.
  • edited September 2017
    I have verified using a goniometer as a background and controlling the Inspector. Everything is OK.
    So I built two identical 2D scenes, one with NavMesh2D and one with NavMeshSegment and compared them.
    I have noticed that the problem is that in NavMesh2D the character apparently slips by walking what does not happen in Screen Space.
    When you have a little time try taking a look at the video and tell me your impressions (I have reduced the size of the Girl to see better).
    Changing in Perspective and modifying Vertical Movement Factor does not change anything.




  • edited September 2017
    Thanks.  I suspect that this is because of the combination of faked perspective in 2D vs the true rotation of the 3D character.  When the character turns, they do so because of the screen-space direction of their movement path - not accounting for the "depth" that the scene is simulating.

    Try this: open up char.cs and find line 646:

    lookDir = new Vector3 (direction.x, 0f, direction.y);

    And replace it with:

    lookDir = new Vector3 (direction.x, 0f, direction.y / KickStarter.sceneSettings.GetVerticalReductionFactor ());

    That will cause the Vertical reduction factor slider (which you can override per-scene in the Scene Manager) to affect the percieved y-facing amount of the character.  See if you can get a slider value that produces a satisfatory result, and if so I'll look to see if such a change can be incorporated officially.
  • Yes, giving the right y-facing things will improve considerably but the character continues to slide. I also tried to change the walking speed at the same time but without getting different results.
    My opinion is that it would not be wrong to officially incorporate this new behavior into 2D because currently facing is altered but will not be resolved (of course for those who would like to use 3D characters in 2D environment, but I fear it will be impossible to achieve a stable walking like in 3D).
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.