How to determine position.y from a wave at coordinate x,z?

Hello to all,

I would like to use this code to find out how to modify the y-coordinate position of my “boats” according to the wave height at the x,z coordinate of the player concerned.

At the moment it is very clear that my boats are not in phase with the movement of the wave

How to do this with vertices?

o.boat[i].mesh.position.y = v.y;
o.boat[i].mesh.position.y = hauteur_wave * Math.sin(o.boat[i].mesh.position.x * longueur_wave + t);

Thanks, codepen updated with your solution :wink:

1 Like