FAQ: Physics & Chaos

Jul 14, 2021.Knowledge

Is physics deterministic between machines?

  • Close, but not perfect. That requires handling elements like fixed point maths.

How do we set collision parameters for instances?

  • The collision parameters are exposed through UPrimitiveComponent::BodyInstance. This is presented as the Collision section in the Details panel of the editor. UInstancedStaticMeshComponent (and descendants) contains an array named InstanceBodies that get populated with copies of BodyInstance.

Does Chaos support coordinate offsets? How are you preparing Chaos for use in very big worlds?

  • Chaos itself is just a solver which will use whatever you want it to, meaning you could always write code that added an offset to everything in a solver and Chaos supports the notion of multiple solvers.

Will the combination of the Task Graph and fixed-step physics be supported in the future?

  • This is not trivial and is not currently supported. It is possible to add but would come with a performance cost. We would need to substep in the case where the game thread DeltaTime is greater than the physics fixed DeltaTime. Because of this, we don’t have current plans to add this functionality.

Can physics commands be queued to run during the next physics frame from inside a physics command? The current implementation suggests they would just run in the same frame.

  • This depends on the tick mode. In the case of a dedicated physics thread, it always works this way if the physics thread is in the middle of a frame. In the case of Task Graph mode it will work this way if the commands are executed after the task has been ticked. In terms of delayed execution, it’s possible to add but not currently on the roadmap.

Is there a way to set up dependencies to always run custom solvers in a specific order?

  • No, there is not a dependency ordering. The idea behind solvers is that the bodies in them are completely independent and ordering shouldn’t matter. The major use case that comes to mind for deterministic ordering is one-way coupled simulations, but it’s not clear how much of a performance benefit that will have compared to putting the bodies in a single solver.

What sort of level of determinism guarantees will we expect from Chaos?

  • In 4.25 we have been made aware of some non deterministic bugs. This is something we aim to address as theoretically it should be deterministic, ignoring size of DT and FPE architectural differences

Is it possible to set up a separate custom physics that shares collision data with the main game Chaos scene through low-level Chaos APIs?

  • This is something we are currently implementing but missed the cut for 4.25, so it’s definitely possible but isn’t a trivial amount of work

Will Niagara play nicely with Chaos + destruction?

  • Our plan is to have Chaos integrate nicely with Niagara