您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
25 行
816 B
25 行
816 B
using Unity.Entities;
|
|
using Unity.Mathematics;
|
|
using static WaterSystem.BuoyantObject2;
|
|
|
|
public struct BuoyantData : IComponentData
|
|
{
|
|
public BuoyancyType type;
|
|
public float voxelResolution;
|
|
public float3 normal;
|
|
public float3 localArchimedesForce;
|
|
public float percentSubmerged;
|
|
public float baseDrag;
|
|
public float baseAngularDrag;
|
|
}
|
|
//you can't have two buffers of the same type on an entity, so you need a new struct for each float3 you want to map.
|
|
public struct VoxelOffset : IBufferElementData
|
|
{
|
|
public float3 Value;
|
|
}
|
|
public struct VoxelHeight : IBufferElementData
|
|
{
|
|
public float3 Value;
|
|
}
|
|
//Now, your query needs to check for BuoyantData, VoxelOffset and VoxelHeight
|
|
//Your component itself doesn't define the behaviour, your query does. And your query probably will have several components in it.
|