I'm newer to Unity so bear with me. I'm using Unity2D
and so far I have my character up and walking around, colliding properly with his surroundings, and I've implemented an effective "isometric sorting"
script which swaps the order of sprites based on their y coordinate. What I'm trying to do now is create a slope that exists in the middle of the stage or front (bottom of screen). I'll illustrate what I'm trying to do as explaining it is bound to be confusing.
Right now, I have the ability to move the player up the slope, and in front of the slope (using the isometric sorting script), but it seems maybe impossible to also be able to have the player walk behind the slope.
Here's my idea for how this could be accomplished, but I certainly would need some direction.
Basically, I'm thinking if I can detect that the player has crossed the green line in the image, I could use that information to flip a switch ON which would lower the slopes sorting priority (thus lowering it beneath the players feet), then I would need it to deactivate when the Player exits the slope.
Here is the Isometric Rendering script:
using UnityEngine;
[ExecuteInEditMode]
public class IsometricSpriteRenderer : MonoBehaviour {
void Update ()
{
GetComponent<Renderer>().sortingOrder = (int)(transform.position.y * -1000);
}
}
Thank you to anyone who bothers to take the time to help me! I really appreciate it!