浏览代码

Fixed categorical parameter random value rounding issue

/addressables-test
Mohsen Kamalzadeh 4 年前
当前提交
dd054f13
共有 1 个文件被更改,包括 11 次插入3 次删除
  1. 14
      com.unity.perception/Runtime/Randomization/Parameters/CategoricalParameter.cs

14
com.unity.perception/Runtime/Randomization/Parameters/CategoricalParameter.cs


public T Sample()
{
var randomValue = m_Sampler.Sample();
return uniform
? m_Categories[(int)(randomValue * m_Categories.Count)]
: m_Categories[BinarySearch(randomValue)];
if (uniform)
{
var index = (int)(randomValue * m_Categories.Count);
if (index == m_Categories.Count)
{
index--;
}
return m_Categories[index];
}
return m_Categories[BinarySearch(randomValue)];
}
/// <summary>

正在加载...
取消
保存