Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved How to rotate shader on custom generated mesh?

Discussion in 'World Building' started by drplis, Nov 6, 2023.

  1. drplis

    drplis

    Joined:
    Nov 5, 2012
    Posts:
    3
    Hi all,

    I am creating a river building system where you place points down for the river to follow. Each river has some UV points associated with it to use with a texture.

    Each control point is associated with the mesh vertices to the left and right of it. When the control point is rotated, the vertices rotate around it. When it is moved, the vertices move with it.

    I am running into the problem of the shader I'm applying to it not moving the correct direction. Instead of going top to bottom, the shader is flowing right to left. As you can see in the photos, the river is flowing from the top long edge to the bottom long edge. I want it to instead flow from the shorter edge furthest away, to the shorter edge closest to the camera.

    I am unsure as to why this happens. I'm thinking it could be due to how I'm building the mesh triangles.

    The control points are denoted with green cubes.
    The UV points are denoted with red cubes.
    The mesh vertices are denoted with yellow cubes.
    upload_2023-11-6_16-16-50.png upload_2023-11-6_16-19-1.png upload_2023-11-6_16-20-11.png

    Any help with this would be very appreciated.
     
    Last edited: Nov 7, 2023