Merge commit 'f2068397fa4542bd034e9d34002cca4b976c31b1' into amzn-tommy/gitflow_211116_o3de2
This commit is contained in:
+50
-22
@@ -9,8 +9,8 @@
|
||||
#include "SlideAlongAxisBasedOnAngle.h"
|
||||
#include "StartingPointCamera/StartingPointCameraUtilities.h"
|
||||
#include <AzCore/Math/Quaternion.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Math/Transform.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
|
||||
namespace Camera
|
||||
{
|
||||
@@ -32,31 +32,43 @@ namespace Camera
|
||||
AZ::EditContext* editContext = serializeContext->GetEditContext();
|
||||
if (editContext)
|
||||
{
|
||||
editContext->Class<SlideAlongAxisBasedOnAngle>("SlideAlongAxisBasedOnAngle", "Slide 0..SlideDistance along Axis based on Angle Type. Maps from 90..-90 degrees")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->DataElement(AZ::Edit::UIHandlers::ComboBox, &SlideAlongAxisBasedOnAngle::m_axisToSlideAlong, "Axis to slide along", "The Axis to slide along")
|
||||
->EnumAttribute(RelativeAxisType::ForwardBackward, "Forwards and Backwards")
|
||||
->EnumAttribute(RelativeAxisType::LeftRight, "Right and Left")
|
||||
->EnumAttribute(RelativeAxisType::UpDown, "Up and Down")
|
||||
->DataElement(AZ::Edit::UIHandlers::ComboBox, &SlideAlongAxisBasedOnAngle::m_angleTypeToChangeFor, "Angle Type", "The angle type to base the slide off of")
|
||||
->EnumAttribute(EulerAngleType::Pitch, "Pitch")
|
||||
->EnumAttribute(EulerAngleType::Roll, "Roll")
|
||||
->EnumAttribute(EulerAngleType::Yaw, "Yaw")
|
||||
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_maximumPositiveSlideDistance, "Max Positive Slide Distance", "The maximum distance to slide in the positive")
|
||||
->Attribute(AZ::Edit::Attributes::Suffix, "m")
|
||||
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_maximumNegativeSlideDistance, "Max Negative Slide Distance", "The maximum distance to slide in the negative")
|
||||
->Attribute(AZ::Edit::Attributes::Suffix, "m")
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "Vector Components To Ignore")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_ignoreX, "X", "When active, the X Component will be ignored.")
|
||||
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_ignoreY, "Y", "When active, the Y Component will be ignored.")
|
||||
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_ignoreZ, "Z", "When active, the Z Component will be ignored.")
|
||||
editContext->Class<SlideAlongAxisBasedOnAngle>("SlideAlongAxisBasedOnAngle",
|
||||
"Slide 0..SlideDistance along Axis based on Angle Type. Maps from 90..-90 degrees")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->DataElement(AZ::Edit::UIHandlers::ComboBox, &SlideAlongAxisBasedOnAngle::m_axisToSlideAlong, "Axis to slide along",
|
||||
"The Axis to slide along")
|
||||
->EnumAttribute(RelativeAxisType::ForwardBackward, "Forwards and Backwards")
|
||||
->EnumAttribute(RelativeAxisType::LeftRight, "Right and Left")
|
||||
->EnumAttribute(RelativeAxisType::UpDown, "Up and Down")
|
||||
->DataElement(AZ::Edit::UIHandlers::ComboBox, &SlideAlongAxisBasedOnAngle::m_angleTypeToChangeFor, "Angle Type",
|
||||
"The angle type to base the slide off of")
|
||||
->EnumAttribute(EulerAngleType::Pitch, "Pitch")
|
||||
->EnumAttribute(EulerAngleType::Roll, "Roll")
|
||||
->EnumAttribute(EulerAngleType::Yaw, "Yaw")
|
||||
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_maximumPositiveSlideDistance, "Max Positive Slide Distance",
|
||||
"The maximum distance to slide in the positive")
|
||||
->Attribute(AZ::Edit::Attributes::Suffix, "m")
|
||||
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_maximumNegativeSlideDistance, "Max Negative Slide Distance",
|
||||
"The maximum distance to slide in the negative")
|
||||
->Attribute(AZ::Edit::Attributes::Suffix, "m")
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "Vector Components To Ignore")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_ignoreX, "X", "When active, the X Component will be ignored.")
|
||||
->Attribute(AZ::Edit::Attributes::ReadOnly, &SlideAlongAxisBasedOnAngle::YAndZIgnored)
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::AttributesAndValues)
|
||||
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_ignoreY, "Y", "When active, the Y Component will be ignored.")
|
||||
->Attribute(AZ::Edit::Attributes::ReadOnly, &SlideAlongAxisBasedOnAngle::XAndZIgnored)
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::AttributesAndValues)
|
||||
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_ignoreZ, "Z", "When active, the Z Component will be ignored.")
|
||||
->Attribute(AZ::Edit::Attributes::ReadOnly, &SlideAlongAxisBasedOnAngle::XAndYIgnored)
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::AttributesAndValues)
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SlideAlongAxisBasedOnAngle::AdjustLookAtTarget([[maybe_unused]] float deltaTime, [[maybe_unused]] const AZ::Transform& targetTransform, AZ::Transform& outLookAtTargetTransform)
|
||||
void SlideAlongAxisBasedOnAngle::AdjustLookAtTarget(
|
||||
[[maybe_unused]] float deltaTime, [[maybe_unused]] const AZ::Transform& targetTransform, AZ::Transform& outLookAtTargetTransform)
|
||||
{
|
||||
float angle = GetEulerAngleFromTransform(outLookAtTargetTransform, m_angleTypeToChangeFor);
|
||||
float currentPositionOnRange = -angle / AZ::Constants::HalfPi;
|
||||
@@ -67,4 +79,20 @@ namespace Camera
|
||||
|
||||
outLookAtTargetTransform.SetTranslation(outLookAtTargetTransform.GetTranslation() + basis * currentPositionOnRange * slideScale);
|
||||
}
|
||||
}
|
||||
|
||||
bool SlideAlongAxisBasedOnAngle::XAndYIgnored() const
|
||||
{
|
||||
return m_ignoreX && m_ignoreY;
|
||||
}
|
||||
|
||||
bool SlideAlongAxisBasedOnAngle::XAndZIgnored() const
|
||||
{
|
||||
return m_ignoreX && m_ignoreZ;
|
||||
}
|
||||
|
||||
bool SlideAlongAxisBasedOnAngle::YAndZIgnored() const
|
||||
{
|
||||
return m_ignoreY && m_ignoreZ;
|
||||
}
|
||||
|
||||
} // namespace Camera
|
||||
|
||||
+7
-3
@@ -6,11 +6,11 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include <CameraFramework/ICameraLookAtBehavior.h>
|
||||
#include <AzCore/Math/Transform.h>
|
||||
#include <AzCore/RTTI/ReflectContext.h>
|
||||
#include "StartingPointCamera/StartingPointCameraConstants.h"
|
||||
#include <AzCore/Math/Transform.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/RTTI/ReflectContext.h>
|
||||
#include <CameraFramework/ICameraLookAtBehavior.h>
|
||||
|
||||
namespace Camera
|
||||
{
|
||||
@@ -38,6 +38,10 @@ namespace Camera
|
||||
void Activate(AZ::EntityId) override {}
|
||||
void Deactivate() override {}
|
||||
|
||||
bool XAndYIgnored() const;
|
||||
bool XAndZIgnored() const;
|
||||
bool YAndZIgnored() const;
|
||||
|
||||
private:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Reflected data
|
||||
|
||||
Reference in New Issue
Block a user