Hi Chris,
Can I get you to make a couple of small changes to this Modifier and the BouyancyNew script to allow for varying water heights (non zero y axis). I'm making a game and decided to use this but I wanted a rising water level...
I played around and got it working using the following changes...
In MegaDynamicRipple.cs I made the following change to apply the Force at the correct height...
public void ForceAt(float x, float y, float force)
{
Vector3 lpos = Vector3.zero;
lpos.x = x;
lpos.z = y;
lpos.y = transform.position.y;
And in BouyancyNew.cs I made the following change to return the correct height from dynamicwater...
private float GetWaterLevel(float x, float z)
{
if ( dynamicwater )
{
Vector3 lpos = Vector3.zero;
lpos.x = x;
lpos.z = z;
return dynamicwater.GetWaterHeight(water.transform.worldToLocalMatrix.MultiplyPoint(lpos)) + dynamicwater.transform.position.y;
}
// return ocean == null ? 0.0f : ocean.GetWaterHeightAtLocation(x, z);
return 0.0f;
}
This is obviously a hack and may break things that I'm not taking into consideration π , but if you could implement this it would be great.
Cheers, Phil.
[EDIT] 1. I notice that the ripples aren't applying any changes back to the buoyant object when it's not at zero height :/
[EDIT] 2. The ripple effect from a buoyant object also shows up at the wrong spot when the z axis is changed.
|