internal static CapsuleGeometry BakeToBodySpace(
     this CapsuleGeometry capsule, float4x4 localToWorld, float4x4 shapeToWorld,
     out float3 center, out float height, ref EulerAngles orientation
     )
 {
     using (var geometry = new NativeArray <CapsuleGeometry>(1, Allocator.TempJob)
     {
         [0] = capsule
     })
         using (var outCenter = new NativeArray <float3>(1, Allocator.TempJob))
             using (var outHeight = new NativeArray <float>(1, Allocator.TempJob))
                 using (var outOrientation = new NativeArray <EulerAngles>(1, Allocator.TempJob)
                 {
                     [0] = orientation
                 })
                 {
                     var job = new BakeCapsuleJob
                     {
                         Capsule      = geometry,
                         Center       = outCenter,
                         Height       = outHeight,
                         Orientation  = outOrientation,
                         localToWorld = localToWorld,
                         shapeToWorld = shapeToWorld
                     };
                     job.Run();
                     center      = outCenter[0];
                     height      = outHeight[0];
                     orientation = outOrientation[0];
                     return(geometry[0]);
                 }
 }
Пример #2
0
 internal static CapsuleGeometryAuthoring BakeToBodySpace(
     this CapsuleGeometryAuthoring capsule, float4x4 localToWorld, float4x4 shapeToWorld
     )
 {
     using (var geometry = new NativeArray <CapsuleGeometryAuthoring>(1, Allocator.TempJob)
     {
         [0] = capsule
     })
     {
         var job = new BakeCapsuleJob
         {
             Capsule      = geometry,
             localToWorld = localToWorld,
             shapeToWorld = shapeToWorld
         };
         job.Run();
         return(geometry[0]);
     }
 }