Moving Sprite through a Ring

Hey :slight_smile:

Is there a way to make a sprite move through a loop such that it passes in front of one half of the loop and behind the other? Imagine a 2D version of a basketball hoop where you are looking slightly downward at the hoop so you can see the back and front of the hoop. When the basketball is passing through the center, it would appear in front of the back part of the hoop but behind the front part of the hoop. At that instance, some of the ball should be rendered on top of the hoop, and some behind.

Is there any way to do this in 2D? For my game the hoop is actually vertical and the object passing through is moving from left to right across the screen. I tried rotating the sprite about the Y-axis, which tilts it like it should be. When I move the object through it in Scene View 3D mode, the ball appears to move through it, but when looking through the 2D camera, the ball is either completely behind it or complete in front, not passing through.

Any suggestions on how to accomplish this?

Thanks!

Need to view the problem as 2D. In 2D you have only the two planes. The way to get the effect you are after is to make your ring a complex object. Meaning the ring should consist of two separate objects positioned appropriately to look like one object.

Then you can adjust the sorting order so 1/2 of the ring is drawn before the player is drawn and the other half is drawn after the player is drawn.

Great thanks! I figured that was likely the solution but was hopeful there was a way to do it with one object.

Thanks!