Customizing FluidVolume
Posted: Fri Jan 25, 2013 12:13 pm
Hi norbo
I am just playing around with the FluidVolume class. I've implemented a little game that now uses gerstner waves to render a more realistic ocean than just a textured plane. For now these waves have only been a visual eye-candy, but the waves have no physical influence to the objects that are floating within. So I was wondering how I could implement this. To do so I've modified the FluidVolume a bit. What I have from my wave function is:
- a method that returns the normal of the wave at a specific point
- a method that returns the height of the wave at a specific point
- a method that returns the complete offset for a specific point (my wavefunction includes longitudinal waves as well, so this might be useful)
So my question is how do I combine this into the FluidVolume? I've tried already the following:
[*]I've replaced the code that checks if the entity is in the water just by the following:
[*]I've replaced the upvector with the normal of the wave
Well, that works, but as usual not as expected:-D Now my boat jumps up and down a bit unrealistic and the boat seems to float around instead of performing something like rolling.
I guess I not doing this correctly, can you give me a hint how to implement proper behaviour (i.E the boat should drift and climb if a huge wave comes in).
PS: there's a little video of my game, it includes several boats with the BEPU logo on it
http://www.youtube.com/watch?v=MwX8_taklLM
I am just playing around with the FluidVolume class. I've implemented a little game that now uses gerstner waves to render a more realistic ocean than just a textured plane. For now these waves have only been a visual eye-candy, but the waves have no physical influence to the objects that are floating within. So I was wondering how I could implement this. To do so I've modified the FluidVolume a bit. What I have from my wave function is:
- a method that returns the normal of the wave at a specific point
- a method that returns the height of the wave at a specific point
- a method that returns the complete offset for a specific point (my wavefunction includes longitudinal waves as well, so this might be useful)
Code: Select all
float GetWaveHeight(Vector2 initialPosition);
Vector3 GetWaveNormal(Vector2 initialPosition);
Vector3 GetWavePosition(Vector2 initialPosition);
[*]I've replaced the code that checks if the entity is in the water just by the following:
Code: Select all
Vector3 position = entityEntry.worldTransform.Position;
if (position.Y > WaveSampler.GetWaveHeight(new Vector2(position.X, position.Z)))
{
return;
}
Well, that works, but as usual not as expected:-D Now my boat jumps up and down a bit unrealistic and the boat seems to float around instead of performing something like rolling.
I guess I not doing this correctly, can you give me a hint how to implement proper behaviour (i.E the boat should drift and climb if a huge wave comes in).
PS: there's a little video of my game, it includes several boats with the BEPU logo on it
