- Home /
Bouyancy timing issue
Been really struggling with this, I have been foloowing along with a number of tutorials to make a Boat float in water and have gotten some mixed results.
The main method that I am using is so have the water mesh displaced via shader:
Then replicating the same calculations in my c# side to sample a world space point:
public float WaterHeightAtPosition(Vector3 position)
{
return ocean.position.y + wavesDisplacement.GetPixelBilinear(
position.x * wavesFrequency,
position.z * wavesFrequency + Time.time * wavesSpeed
).g * wavesHeight;
}
But the water height positions that the method is returning do not match the positions on the waves.
on a previous try I used a simple sin wave and had the same issue - don't think the math is off (might be)
I think it might have something to do with the water scale or something that I have no idea to look for :D
I have tried setting the water to 1,1,1 scale but I get a very noisey plane (and the water height positions still look off)
any help/ideas etc would be appreciated!
Your answer
Follow this Question
Related Questions
How to Script Buoyancy with a Water Shader 2 Answers
Water & Fabric compute shader 0 Answers
Help with Liquid Physics2D 0 Answers
Water Ripples 1 Answer
Having trouble to getting the height from an object being displaced by a shader 1 Answer