コード例 #1
0
    protected override void OnFixedUpdate()
    {
        Vector3 pos = transform.localPosition;

        pos += _vel * Time.fixedDeltaTime;
        Vector3 halfBound = _bounds / 2;

        pos = VectorUtil.ClampXY(pos, _origin - halfBound, _origin + halfBound);
        transform.localPosition = pos;
    }