Merge branch 'fix_physx_addactor' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-fix_physx_addactor

This commit is contained in:
Wojtek Figat
2022-05-13 19:17:16 +02:00

View File

@@ -68,7 +68,6 @@ struct ScenePhysX
float LastDeltaTime = 0.0f; float LastDeltaTime = 0.0f;
FixedStepper Stepper; FixedStepper Stepper;
SimulationEventCallback EventsCallback; SimulationEventCallback EventsCallback;
Array<PxActor*> AddActors;
Array<PxActor*> RemoveActors; Array<PxActor*> RemoveActors;
Array<PhysicsColliderActor*> RemoveColliders; Array<PhysicsColliderActor*> RemoveColliders;
Array<Joint*> RemoveJoints; Array<Joint*> RemoveJoints;
@@ -1279,7 +1278,7 @@ void PhysicsBackend::AddSceneActor(void* scene, void* actor)
{ {
auto scenePhysX = (ScenePhysX*)scene; auto scenePhysX = (ScenePhysX*)scene;
FlushLocker.Lock(); FlushLocker.Lock();
scenePhysX->AddActors.Add((PxActor*)actor); scenePhysX->Scene->addActor(*(PxActor*)actor);
FlushLocker.Unlock(); FlushLocker.Unlock();
} }
@@ -2990,13 +2989,6 @@ void PhysicsBackend::FlushRequests(void* scene)
auto scenePhysX = (ScenePhysX*)scene; auto scenePhysX = (ScenePhysX*)scene;
FlushLocker.Lock(); FlushLocker.Lock();
// Add objects
if (scenePhysX->AddActors.HasItems())
{
scenePhysX->Scene->addActors(scenePhysX->AddActors.Get(), scenePhysX->AddActors.Count());
scenePhysX->AddActors.Clear();
}
// Perform latent actions // Perform latent actions
for (int32 i = 0; i < scenePhysX->Actions.Count(); i++) for (int32 i = 0; i < scenePhysX->Actions.Count(); i++)
{ {