Querying from physics thread

Hello,

We are doing queries (like UWorld::LineTraceSingleByChannel) directly from the physics thread, from a sim callback in OnPreSimulate_Internal() call.

I have just discovered that these queries are processing the GTData, which does not seem safe to me.

After digging a little bit, I could see that

const EThreadQueryContext ThreadContext = GetThreadQueryContext(*World->GetPhysicsScene()->GetSolver());

is going through this

//TODO: need a way to know we are on a physics thread task (this isn't supported yet)
//For now just use interpolated data
return EThreadQueryContext::GTData;

Ideally, I feel like returning PTData in my case would be more safe.

Do you agree with it ?

If so, is there any solution to solve this TODO ?

Thanks a lot,

Romain

[Attachment Removed]

Hi Romain,

Have you checked into how the modular vehicle code does this? I recall seeing it had a different implementation which may mitigate these (valid) concerns.

There isn’t much scheduled in this area at the moment that I’m aware of.

Best

Geoff

[Attachment Removed]

Hey,

Indeed I’m currently using the same approach which is using Chaos::Private::FGenericPhysicsInterface_Internal APIs.

I will stick to this if you confirm this is the correct approach, which seems good to me.

Cheers,

[Attachment Removed]

Hi Romain,

Yep, that is the recommended way at the moment!

Best

Geoff

[Attachment Removed]