コード例 #1
0
        protected override void UpdateShape(GameObject root)
        {
            Fix64     h  = CalculateHeight();
            Fix64     r  = CalculateRadius();
            Fix64Vec3 p1 = Fix64Vec3.zero;
            Fix64Vec3 p2 = Fix64Vec3.zero;

            CalculatePoints(h, r, ref p1, ref p2);

            if (p1 == Fix64Vec3.zero || p2 == Fix64Vec3.zero)
            {
                Debug.LogError("Invalid Size");
                return;
            }

            Fix64Vec3 center   = Fix64Vec3.zero;
            Fix64Quat rotation = Fix64Quat.identity;

            if (gameObject != root)
            {
                center   = _pTransform.localPosition;
                rotation = _pTransform.localRotation;
            }

            point1 = p1;
            point2 = p2;
            radius = r;
            height = h;
            Parallel3D.UpdateCapsule(_shape, _fixture, p1, p2, radius, center, rotation);
        }