My aim is to get swimming locked to the top of the water.
So far i have got it locked to Z as i enter the water. but this only works correctly with level water sources. i have a sloped river so this solution causes me to swim out of the water as i swim down stream and under it as i swim upstream.
the solution i have thought of is to calculate the z location of the water relative to the players current position. I am quite new to unreal so any help on how to achieve this would be great!
How did you make the river? Is it using a spline? If so you can sample the location on the spline that’s close to your player and use the Z component of that location.
If not using a spline, create an actor, add a spline component, add the actor to the level, modify the spline to match the river, then like above, sample the location closest to player and use the Z value to clamp player location.
When i start the WaterZ location is 0.0 untill i am submerged which results in me walking too far into the water on the first time i enter it. after that its fine as it correctly reads the location.
do you have any ideas on what could be causing this? or a way to get it to read correctly on loading so i get the level before entering the water?