Fixed pre & post physics transforms update routines
This commit is contained in:
parent
43a5cb4deb
commit
afd2abf036
|
@ -82,7 +82,7 @@
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 0, y: 4.28833103, z: 0}
|
Translate: {x: 0, y: 4.28833103, z: 0}
|
||||||
Rotate: {x: -0, y: 0, z: -0}
|
Rotate: {x: -0, y: 0, z: -0}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1, y: 0, z: 1}
|
||||||
IsActive: true
|
IsActive: true
|
||||||
RigidBody Component:
|
RigidBody Component:
|
||||||
Type: Dynamic
|
Type: Dynamic
|
||||||
|
@ -108,14 +108,6 @@
|
||||||
Density: 1
|
Density: 1
|
||||||
Position Offset: {x: 0, y: 0, z: 0}
|
Position Offset: {x: 0, y: 0, z: 0}
|
||||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||||
- Is Trigger: false
|
|
||||||
Type: Box
|
|
||||||
Half Extents: {x: 2, y: 2, z: 2}
|
|
||||||
Friction: 0.400000006
|
|
||||||
Bounciness: 0
|
|
||||||
Density: 1
|
|
||||||
Position Offset: {x: 0, y: 0, z: 0}
|
|
||||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 65537
|
- EID: 65537
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace SHADE
|
||||||
|
|
||||||
for (auto value : values)
|
for (auto value : values)
|
||||||
{
|
{
|
||||||
max = Min(max, value);
|
max = Max(max, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return max;
|
return max;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "ECS_Base/Managers/SHComponentManager.h"
|
#include "ECS_Base/Managers/SHComponentManager.h"
|
||||||
#include "ECS_Base/Managers/SHEntityManager.h"
|
#include "ECS_Base/Managers/SHEntityManager.h"
|
||||||
#include "ECS_Base/Managers/SHSystemManager.h"
|
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||||
|
#include "Editor/SHEditor.h"
|
||||||
#include "Math/SHMathHelpers.h"
|
#include "Math/SHMathHelpers.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
@ -35,7 +36,7 @@ namespace SHADE
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SHTransformSystem::TransformPostPhysicsUpdate::TransformPostPhysicsUpdate()
|
SHTransformSystem::TransformPostPhysicsUpdate::TransformPostPhysicsUpdate()
|
||||||
: SHSystemRoutine { "Transform Post-Physics Update", false }
|
: SHSystemRoutine { "Transform Post-Physics Update", true }
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,9 +55,30 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
// Get the current scene graph to traverse and update
|
// Get the current scene graph to traverse and update
|
||||||
const auto& SCENE_GRAPH = SHSceneManager::GetCurrentSceneGraph();
|
const auto& SCENE_GRAPH = SHSceneManager::GetCurrentSceneGraph();
|
||||||
|
|
||||||
|
#ifdef SHEDITOR
|
||||||
|
|
||||||
|
// When editor is not in play, only clear all dirty flags. No update required.
|
||||||
|
|
||||||
|
const auto* EDITOR = SHSystemManager::GetSystem<SHEditor>();
|
||||||
|
if (EDITOR && EDITOR->editorState != SHEditor::State::PLAY)
|
||||||
|
{
|
||||||
|
auto& transformsSet = SHComponentManager::GetDense<SHTransformComponent>();
|
||||||
|
for (auto& tfComp : transformsSet)
|
||||||
|
tfComp.dirty = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
UpdateEntity(SCENE_GRAPH.GetRoot(), true);
|
UpdateEntity(SCENE_GRAPH.GetRoot(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
UpdateEntity(SCENE_GRAPH.GetRoot(), true);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void SHTransformSystem::Init()
|
void SHTransformSystem::Init()
|
||||||
{
|
{
|
||||||
const std::shared_ptr CHANGE_PARENT_RECEIVER { std::make_shared<SHEventReceiverSpec<SHTransformSystem>>(this, &SHTransformSystem::ChangeParent) };
|
const std::shared_ptr CHANGE_PARENT_RECEIVER { std::make_shared<SHEventReceiverSpec<SHTransformSystem>>(this, &SHTransformSystem::ChangeParent) };
|
||||||
|
|
Loading…
Reference in New Issue