Files
o3de/Gems/LmbrCentral/Code/Source/Shape/AxisAlignedBoxShape.cpp
T
John Jones-Steele 817f8ce4c1 Terrain/jjjoness/3172 axis aligned box shape component (#3981)
* CHanges to Push/Pop Matrix

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Fixed bad commit

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* REmoved the AxisAlignedBoxShapeComponentBux and AxisAlignedBoxShapeConfig

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Fixed derivation of AxisAlignedBoxShape

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Added ShowChildrenOnly to Component

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Fixed cmake file

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Changes from review

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Added tests for AxisAlignedBoxShape

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Addressed PR comments and added one further test.

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Removed dead code.

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Changes from review

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Spelling fix and changed link to docs

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Fixed profile bug in Linux

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Fixed problem with Unity Profile Build in Tests

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>
2021-09-08 10:50:29 -05:00

60 lines
1.9 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AxisAlignedBoxShape.h"
#include <AzCore/Math/Color.h>
#include <AzCore/Math/IntersectSegment.h>
#include <AzCore/Math/Transform.h>
#include <AzCore/Math/Matrix3x3.h>
#include <AzCore/Math/Random.h>
#include <AzCore/Math/Sfmt.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/std/algorithm.h>
#include <AzCore/std/containers/array.h>
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
#include <Shape/ShapeDisplay.h>
#include <random>
namespace LmbrCentral
{
AxisAlignedBoxShape::AxisAlignedBoxShape()
: BoxShape()
{
}
void AxisAlignedBoxShape::Reflect(AZ::ReflectContext* context)
{
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<AxisAlignedBoxShape, BoxShape>()
->Version(1)
;
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<AxisAlignedBoxShape>("Axis Aligned Box Shape", "Axis Aligned Box shape configuration parameters")
;
}
}
}
void AxisAlignedBoxShape::Activate(AZ::EntityId entityId)
{
BoxShape::Activate(entityId);
m_currentTransform.SetRotation(AZ::Quaternion::CreateIdentity());
}
void AxisAlignedBoxShape::OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world)
{
AZ::Transform worldNoRotation(world.GetTranslation(), AZ::Quaternion::CreateIdentity(), world.GetUniformScale());
BoxShape::OnTransformChanged(local, worldNoRotation);
}
} // namespace LmbrCentral