from 物理演算の改善

  • 物理演算でスライドが近寄ってくる現象
    • そもそも物理演算が起きるということはスライドが混んでいて衝突しているということなので、近づくのはおかしい
    • というわけで近寄らないようにした。こんな感じ cs
// update position
for (int i = 0; i < slides.Count; i++)
{
    GameObject obj = slides[i] as GameObject;
    // current position and distance
    Vector3 cpos = obj.transform.position;
    float cdist = (cpos - eye).magnitude;
    // next position and distance
    Vector3 npos = cpos + updateVec[obj];
    float ndist = (npos - eye).magnitude;
    if(ndist < cdist)
    {
        npos = eye + (npos - eye).normalized * cdist;
    }
    obj.transform.position = npos;
}