I’m trying to use the example of Normal Water, to make the waves of my character. However, the waves seem to mirror my moves, so if I enter on water waves appear in the opposite corner, and it moves in the opposite direction.
I attach the particles to the player.
Is there a way to change this???
Here is the code:
function Update () {
wavesCamera.transform.position = playerCamera.position + Vector3.Scale(playerCamera.forward * wavesCamera.orthographicSize * fudgeFactor, Vector3(1,0,1));
var waterCorner = waterPlaneRenderer.bounds.center - waterPlaneRenderer.bounds.extents;
var camPos = (wavesCamera.transform.position -Vector3.one * wavesCamera.orthographicSize) - waterCorner;
var boundsSize = waterPlaneRenderer.bounds.size;
var normalizedPosition = -Vector2(camPos.x /boundsSize.x, camPos.z / boundsSize.z);
var scale = Vector2(boundsSize.x, boundsSize.z) / wavesCamera.orthographicSize / 2;
waterPlaneRenderer.material.SetTextureOffset("_BumpMap", Vector3.Scale(normalizedPosition, scale));
waterPlaneRenderer.material.SetTextureScale ("_BumpMap", scale);
}
Thanks