I managed a rather hacky workaround for this issue. My props in question move around the map. I now check if they moved successfully to the new location after a call to TeleportTo[]
. If they did not, I assume they are no longer valid and I call Dispose()
. After calling Dispose()
on a prop, any call to IsValid[]
now correctly returns true.
Pseudo code:
OldPosition := Prop.GetTransform().Translation
NewPosition := OldPosition + vector3{X:=1.0, Y:=0.0, Z:=0.0}
if (Prop.TeleportTo[NewPosition, IdentityRotation()]):
CheckPosition := Prop.GetTransform().Translation
Diff := CheckPosition - OldPosition
if (Diff.Length = 0):
# We didn't teleport to new position!
Prop.Dispose()
:
:
# somewhere else in code, this will now return true for disposed prop
if (not Prop.IsValid[]):
# do stuff
Note: TeleportTo[]
does not seem to fail if a prop is not valid.
I realize this is less than ideal and won’t work for everyone. If you are already moving props within your game loops, this could help.