浏览代码

-Added debug code to buoyant object class

/dots-input
Mike Geig 5 年前
当前提交
830bae60
共有 2 个文件被更改,包括 9 次插入4 次删除
  1. 12
      Packages/com.verasl.water-system/Scripts/BuoyantObject.cs
  2. 1
      Packages/com.verasl.water-system/Scripts/Water.cs

12
Packages/com.verasl.water-system/Scripts/BuoyantObject.cs


if(_buoyancyType == BuoyancyType.PhysicalVoxel)
{
Debug.Log("new pass: " + gameObject.name);
UpdateDrag(submergedAmount);
//UpdateDrag(submergedAmount);
}
else if(_buoyancyType == BuoyancyType.Physical)
{

_debug.position = wp;
_debug.waterHeight = waterLevel;
_debug.force = Vector3.zero;
Vector3 force = Vector3.zero;
if (wp.y - voxelResolution < waterLevel)
{

var velocity = RB.GetPointVelocity(wp);
velocity.y *= 2f;
var localDampingForce = DAMPFER * RB.mass * -velocity;
var force = localDampingForce + Mathf.Sqrt(k) * localArchimedesForce;//\
force = localDampingForce + Mathf.Sqrt(k) * localArchimedesForce;//\
}
}
Debug.Log(string.Format("Position: {0:f1} -- Force: {1:f2} -- Height: {2:f2}\nVelocty: {3:f2} -- Damp: {4:f2} -- Mass: {5:f1} -- K: {6:f2}", wp, force, waterHeight, velocity, localDampingForce, RB.mass, localArchimedesForce));
}
}
private void UpdateDrag(float submergedAmount)
{

1
Packages/com.verasl.water-system/Scripts/Water.cs


{
waterTime = Time.time;
Shader.SetGlobalFloat("_GlobalTime", waterTime);
GerstnerWavesJobs.UpdateHeights();
}
public void FragWaveNormals(bool toggle)

正在加载...
取消
保存