Code review feedback
This commit is contained in:
@@ -1820,11 +1820,13 @@ void Actor::SetPhysicsScene(PhysicsScene* scene)
|
||||
_physicsScene = scene;
|
||||
|
||||
if (previous != _physicsScene)
|
||||
{
|
||||
OnPhysicsSceneChanged(previous);
|
||||
|
||||
// cascade
|
||||
for (auto child : Children)
|
||||
child->SetPhysicsScene(scene);
|
||||
// cascade
|
||||
for (auto child : Children)
|
||||
child->SetPhysicsScene(scene);
|
||||
}
|
||||
}
|
||||
|
||||
PhysicsScene* Actor::GetPhysicsScene()
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "RigidBody.h"
|
||||
#include "PxMaterial.h"
|
||||
#include <iterator>
|
||||
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Physics/Utilities.h"
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "Engine/Engine/Time.h"
|
||||
#include "Engine/Physics/PhysicalMaterial.h"
|
||||
#include "Engine/Physics/PhysicsScene.h"
|
||||
|
||||
#include <ThirdParty/PhysX/PxRigidActor.h>
|
||||
#include <ThirdParty/PhysX/PxRigidDynamic.h>
|
||||
#include <ThirdParty/PhysX/characterkinematic/PxController.h>
|
||||
|
||||
@@ -232,6 +232,5 @@ protected:
|
||||
void OnParentChanged() override;
|
||||
void OnTransformChanged() override;
|
||||
void OnLayerChanged() override;
|
||||
|
||||
void OnPhysicsSceneChanged(PhysicsScene* previous) override;
|
||||
};
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||
|
||||
#include "CollisionData.h"
|
||||
#include "PhysicsScene.h"
|
||||
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Content/Content.h"
|
||||
#include "Engine/Content/Assets/Model.h"
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
#include "Engine/Physics/Physics.h"
|
||||
#include "Engine/Physics/PhysicsScene.h"
|
||||
#include "Engine/Physics/Utilities.h"
|
||||
#include "Engine/Physics/CollisionData.h"
|
||||
#include "Engine/Physics/CollisionCooking.h"
|
||||
#include "Engine/Threading/Threading.h"
|
||||
#include <ThirdParty/PhysX/extensions/PxDefaultStreams.h>
|
||||
|
||||
@@ -503,7 +503,7 @@ void Physics::FlushRequestsAll()
|
||||
scene->FlushRequests();
|
||||
}
|
||||
|
||||
void Physics::RemoveJointAll(Joint* joint)
|
||||
void Physics::RemoveJoint(Joint* joint)
|
||||
{
|
||||
for (auto scene : Scenes)
|
||||
scene->RemoveJoint(joint);
|
||||
|
||||
@@ -589,7 +589,7 @@ public:
|
||||
/// Marks that joint has been removed (all collision events should be cleared to prevent leaks of using removed object).
|
||||
/// </summary>
|
||||
/// <param name="joint">The joint.</param>
|
||||
static void RemoveJointAll(Joint* joint);
|
||||
static void RemoveJoint(Joint* joint);
|
||||
|
||||
public:
|
||||
static void BeginPlay();
|
||||
|
||||
@@ -92,7 +92,7 @@ static PxQueryHitType::Enum WheelRaycastPreFilter(PxFilterData filterData0, PxFi
|
||||
|
||||
#endif
|
||||
|
||||
PhysicsScene::PhysicsScene(String name, PhysicsSettings settings, CPUInfo cpuInfo)
|
||||
PhysicsScene::PhysicsScene(const String& name, const PhysicsSettings& settings)
|
||||
: PersistentScriptingObject(SpawnParams(Guid::New(), TypeInitializer))
|
||||
{
|
||||
#define CHECK_INIT(value, msg) if(!value) { LOG(Error, msg); return; }
|
||||
@@ -112,7 +112,7 @@ PhysicsScene::PhysicsScene(String name, PhysicsSettings settings, CPUInfo cpuInf
|
||||
sceneDesc.bounceThresholdVelocity = settings.BounceThresholdVelocity;
|
||||
if (sceneDesc.cpuDispatcher == nullptr)
|
||||
{
|
||||
mCpuDispatcher = PxDefaultCpuDispatcherCreate(Math::Clamp<uint32>(cpuInfo.ProcessorCoreCount - 1, 1, 4));
|
||||
mCpuDispatcher = PxDefaultCpuDispatcherCreate(Math::Clamp<uint32>(Platform::GetCPUInfo().ProcessorCoreCount - 1, 1, 4));
|
||||
CHECK_INIT(mCpuDispatcher, "PxDefaultCpuDispatcherCreate failed!");
|
||||
sceneDesc.cpuDispatcher = mCpuDispatcher;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "SimulationEventCallback.h"
|
||||
|
||||
#include "Engine/Physics/SimulationEventCallback.h"
|
||||
#include "Engine/Scripting/ScriptingObject.h"
|
||||
#include "Engine/Scripting/ScriptingType.h"
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
@@ -32,7 +31,7 @@ API_CLASS(NoSpawn) class FLAXENGINE_API PhysicsScene : public PersistentScriptin
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(PhysicsScene);
|
||||
|
||||
explicit PhysicsScene(String name, PhysicsSettings settings, CPUInfo cpuInfo);
|
||||
explicit PhysicsScene(const String& name, const PhysicsSettings& settings);
|
||||
~PhysicsScene();
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user