[Verse] Struct losing information on instantiation?

any clues as to what might be the cause?

                InPropTransform := AsProp.GetTransform()

                Print("Found new Movement Struct for index {Index} with Starting {InPropTransform.Translation }")

                var InitialRotation : rotation = InPropTransform.Rotation
                var Location : vector3 = InPropTransform.Translation

                set Location = Location  + (InitialRotation.GetLocalForward() * Prop.MoveInDirectionAmount.X) 
                       + (InitialRotation.GetLocalRight() * Prop.MoveInDirectionAmount.Y)
                       + (InitialRotation.GetLocalUp() * Prop.MoveInDirectionAmount.Z)

                InPropTargetTransform := transform{Scale := InPropTransform.Scale, Rotation := InitialRotation, Translation := Location}

                Print("Processed new Movement Struct for index {Index} with Starting {InPropTargetTransform.Translation }")

                set bResult = true
                var NewItem : prop_transform_struct = prop_transform_struct {
                            bIsTransformActive := true,
                            InitialTransform := InPropTransform, 
                            TargetTransform := InPropTargetTransform, 
                            ChildIndexArray := Index
                            NumberOfLoops := 0
                        } 
                set TransformArray = TransformArray  + array { NewItem }

                Print("Adding new Movement Struct for index {Index} with Starting {NewItem.InitialTransform.Translation }, Target {NewItem.TargetTransform.Translation}")
            else:
                Print("Index {Index} could not get added. Prop is probably not valid")

when NewItem gets constructed, both transforms are zeroed even though they’re both valid inputs

I’m doing these struct constructions with this struct in multiple places and observing similar behavior (data doesn’t make it through)… is there something important I’m missing here?

For more information, I have two interacting structs,

transform_device_base has an array (non editable) of prop_transform_struct{}, which stores the basic data of each transform entry.

transform_linearlocation_device has an array (editable) of prop_transform_linearlocation_struct{} which interact via structure of array model.

so they interact in

if (TransformItem := TransformArray[Index], LinearItem := LinearArray[Index]):
   DoStuff()

LinearArray is defaults only - it’s the transform array that I’m updating constantly whenever things start/stop/wait for movement

the answer is simple, though not exactly obvious.

Two things were going on:

  • Items were not being initialized in order
  • Not all items were being initialized

Once I fixed those two aspects, all data made it through.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.