Search Unity

2d platform - shadow of character when he is at the edge

Discussion in '2D' started by cybergamedeveloper, Feb 20, 2021.

  1. cybergamedeveloper

    cybergamedeveloper

    Joined:
    Aug 10, 2020
    Posts:
    5
    I have a character in 2D platform.
    The shadow is an eclipse that rendered at the bottom and on top of the floor/platform where he stands on.
    However, when moves to the edge of the platform, the shadow sprite is fully rendered.

    i want to render only the partial of the shadow sprite and it should be cut off at the edge.
    Any suggestion will be appreciated.

    I was thinking about keeping raycasting down at both ends of the shadow and crop the size of the shadow sprite based on the hit results. However will this be overkill if there are many objects at the scene?