Repository navigation
Vehicle Constraint enabled too soon? #1857
|
I have a general question about vehicle constraints. I am currently finishing some modifications to my game engine to make loading of scene assets occur through worker threads. This includes creating physics bodies and in appropriate cases vehicle constraints, even while the current scene is still running. This is part of an effort to stream in sections of a world in real time. Once everything is preloaded, a single thread inserts them all into the physics system. But I noticed that the vehicle constraint is enabled upon instantiation prior to the bodies being inserted, and this leads to problems (asserts in Jolt) when the main thread steps the world. My current solution is to disable the vehicle constraints as I create them (in their worker thread) and then enable them as the assets' bodies are inserted into the system. But it feels like this isn't the way I would imagine I should be doing this with vehicle constraints. Is there a best practice for this that I should look into? |
Replies: 1 comment
|
This requires very particular repro steps:
In this case, I've applied a fix in 62fa918 In general, I would:
If you do this earlier, systems may start to interact with content that is not supposed to 'exist' yet. |
This requires very particular repro steps:
PhysicsSystemVehicleConstraint::OnStepIn this case,
VehicleConstraint::OnStepwould mark the constraint as active (due to the active body under the wheels) at which point the system tries to activate the vehicle body. This fails because it is not in thePhysicsSystem.I've applied a fix in 62fa918
In general, I would: