Exemplo n.º 1
0
        internal static SphereGeometry GetBakedSphereProperties(this PhysicsShapeAuthoring shape, out EulerAngles orientation)
        {
            var sphere = shape.GetSphereProperties(out orientation);
            var center = sphere.Center;
            var radius = sphere.Radius;

            var basisToWorld  = GetBasisToWorldMatrix(shape.transform.localToWorldMatrix, center, orientation, 1f);
            var basisPriority = basisToWorld.HasShear() ? GetBasisAxisPriority(basisToWorld) : k_DefaultAxisPriority;
            var bakeToShape   = GetPrimitiveBakeToShapeMatrix(shape, ref center, ref orientation, 1f, basisPriority);

            radius *= math.cmax(
                new float3(math.length(bakeToShape.c0), math.length(bakeToShape.c1), math.length(bakeToShape.c2))
                );

            return(new SphereGeometry
            {
                Center = center,
                Radius = radius
            });
        }
Exemplo n.º 2
0
        internal static SphereGeometry GetBakedSphereProperties(this PhysicsShapeAuthoring shape, out EulerAngles orientation)
        {
            var sphere = shape.GetSphereProperties(out orientation);

            return(sphere.BakeToBodySpace(shape.transform.localToWorldMatrix, shape.GetShapeToWorldMatrix(), ref orientation));
        }