[Request] Allow the 'Physics Interface' to query arbitrary physics scenes

I am trying to write a deterministic-lockstep game sim for rts games, that features interpolation between frames for the actors used to display the game state. Because I want to retain the usual actor physics for these actors while not having it affect the gamestate I need to separately do collision detection on the game sim version of the entities. I was quite excited to find out that the physics representation of actors happens in its own ‘physics scene’. The header file for the class for this scene informed me that it could do low level physics simulation not associated with a world.

After getting a physics scene to be started by a world subsystem, and some custom components that register a second body instance with this scene, I needed to try query it. This is where the whole thing has come off the rails.

Problem 1: Physics interface takes a world, not a physics scene. I looked at the code for this and saw most of this code uses the world pointer to call get physics scene. I now needed to write my own versions of these functions.

Problem 2: Large portions of the code that these functions used required includes from engine’s private headers. I am now replacing those in my plugin.

So my request is, fix problem 1 for me, take a physics scene pointer instead of a world pointer and get the world from the scenes ‘get owning world’ function.

But also reconsider how much of the collision code must be private. My remaining barrier seems to be code that turns the results of a hit buffer into the nice hit result structs to pass back to gameplay code. I had to implement my own collision callback. Why? What is the point of doing that? I just want to be able to shoot rays and sweep shapes. Chaos is almost a great system.

Ok let me add another. Problem 3: Scoped read lock for chaos scenes causes linker errors because nothing is ENGINE_API.

Basically, physics scenes are completely useless unless they are set to the physics scene pointer of a world. I will now attempt to replace FScopedSceneReadLock, a friend class of chaos physics scenes:

// Allow other code to obtain read-locks when needed
	friend struct ChaosInterface::FScopedSceneReadLock;
	friend struct FScopedSceneLock_Chaos;

Yeah, other code in the Engine module. Come on!

1 Like

This is all so wrong… -_-

1 Like