(Jobs) Accessing Array of Structures as Array of Components of Structures (Native Slice Stride?)

I have a structure like

public struct Placement
{
    public float3 position;
    public float3 forward;
    public float3 up;
}

I have a NativeArray<Placement> that is required later. The jobs that fill the position, forward, and up of this struct are different and they require a NativeSlice<float3> each to write to. I would like to use this array of Placement structs as the input to these jobs (possibly having all 3 run in parallel without dependencies on each other). I DO NOT want to copy this AoS to three separate Arrays and back.

I think NativeSlice.SliceWithStride comes into play here, but I can’t tell from the horrendous documentation.

Please don’t provide me any alternatives. I know they exist, but I’d like a solution that fits the above criteria. Thank you!

This has nothing to do with burst but…
you are on the right track

NativeArray<Placement> placement = new NativeArray<Placement>(1234, Allocator.Temp);

NativeSlice<float3> position = placement.Slice().SliceWithStride<float3>(0);
NativeSlice<float3> forward = placement.Slice().SliceWithStride<float3>(12);
NativeSlice<float3> up = placement.Slice().SliceWithStride<float3>(24);

You’re kind of playing with fire with these magic numbers though, so I’d usually do something like this to be a bit safer.

    [StructLayout(LayoutKind.Explicit)]
    public struct Placement
    {
        public const int PositionOffset = 0;
        public const int ForwardOffset = 12;
        public const int UpOffset = 24;
   
        [FieldOffset(PositionOffset)] 
        public float3 position;

        [FieldOffset(ForwardOffset)]
        public float3 forward;

        [FieldOffset(UpOffset)]
        public float3 up;
    }
NativeSlice<float3> position = placement.Slice().SliceWithStride<float3>(Placement.PositionOffset);
NativeSlice<float3> forward = placement.Slice().SliceWithStride<float3>(Placement.ForwardOffset);
NativeSlice<float3> up = placement.Slice().SliceWithStride<float3>(Placement.UpOffset);