return;
DynamicBuffer<VoxelHeight> heights = World.Active.EntityManager.GetBuffer<VoxelHeight>(boat);
DynamicBuffer<VoxelOffset> offsets = World.Active.EntityManager.GetBuffer<VoxelOffset>(boat);
Gizmos.color = Color.red;
Gizmos.DrawSphere(heights[i].Value, .1f);
Gizmos.DrawSphere(new Vector3(transform.position.x + offsets[i].Value.x, heights[i].Value.y, offsets[i].Value.z + transform.position.z), .1f);
if (boat == Entity.Null)
{
boat = conversionSystem.GetPrimaryEntity(transform.parent);
private void Start()
//Application.targetFrameRate = (int)(1f / Time.fixedDeltaTime);
_guid = gameObject.GetInstanceID();
Init();
lastTime = Time.time;
var job = new ForceJob()
dt = Time.deltaTime,
dt = Time.fixedDeltaTime,
offsetBuffer = GetBufferFromEntity<VoxelOffset>(false),
heightBuffer = GetBufferFromEntity<VoxelHeight>(false)
};
float submergedAmount = 0f;
//Debug.Log("new pass: " + entity.ToString());
float3 avPos = float3.zero;
float3 avForce = float3.zero;
float avgHeight = 0;
var job = new HeightJob {
waveData = waveData,
time = Time.deltaTime,
time = Time.time,
[BurstCompile]
public struct HeightJob : IJobForEachWithEntity<Translation, BuoyantData>
public struct HeightJob : IJobForEachWithEntity<Translation, Rotation, BuoyantData>
[ReadOnly]
public NativeArray<Wave> waveData; // wave data stroed in vec4's like the shader version but packed into one
public BufferFromEntity<VoxelHeight> heightBuffer;
// The code actually running on the job
public void Execute(Entity entity, int i, [ReadOnly] ref Translation translation, ref BuoyantData data)
public void Execute(Entity entity, int i, [ReadOnly] ref Translation translation, ref Rotation rot, ref BuoyantData data)
var entityTransform = new RigidTransform(rot.Value, translation.Value);
float3 voxelPos = translation.Value + offsets[vi].Value;
float3 voxelPos = math.transform(entityTransform, offsets[vi].Value);
var waveCountMulti = 1f / waveData.Length;
float3 wavePos = new float3(0f, 0f, 0f);