You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/PhysX/Code/Source/EditorJointComponent.h

79 lines
3.6 KiB
C++

/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzFramework/Physics/Joint.h>
#include <AzFramework/Visibility/BoundsBus.h>
#include <AzToolsFramework/API/ComponentEntitySelectionBus.h>
#include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
#include <PhysX/EditorJointBus.h>
#include <Editor/EditorJointConfiguration.h>
namespace PhysX
{
/// Base class for editor joint components.
class EditorJointComponent
: public AzToolsFramework::Components::EditorComponentBase
, protected AzToolsFramework::EditorComponentSelectionRequestsBus::Handler
, protected AzToolsFramework::EditorComponentSelectionNotificationsBus::Handler
, protected PhysX::EditorJointRequestBus::Handler
, protected AzFramework::EntityDebugDisplayEventBus::Handler
, public AzFramework::BoundsRequestBus::Handler
{
public:
AZ_EDITOR_COMPONENT(EditorJointComponent, "{070CF18E-E328-43A6-9B76-F160CCD64B72}");
static void Reflect(AZ::ReflectContext* context);
// AZ::Component overrides ...
void Activate() override;
void Deactivate() override;
// BoundsRequestBus overrides ...
AZ::Aabb GetWorldBounds() override;
AZ::Aabb GetLocalBounds() override;
protected:
// EditorComponentSelectionRequestsBus overrides ....
AZ::Aabb GetEditorSelectionBoundsViewport(
const AzFramework::ViewportInfo& viewportInfo) override;
bool EditorSelectionIntersectRayViewport(
const AzFramework::ViewportInfo& viewportInfo,
const AZ::Vector3& src, const AZ::Vector3& dir, float& distance) override;
bool SupportsEditorRayIntersect() override { return true; };
// EditorJointRequestBus overrides ...
bool GetBoolValue(const AZStd::string& parameterName) override;
AZ::EntityId GetEntityIdValue(const AZStd::string& parameterName) override;
float GetLinearValue(const AZStd::string& parameterName) override;
AngleLimitsFloatPair GetLinearValuePair(const AZStd::string& parameterName) override;
AZ::Transform GetTransformValue(const AZStd::string& parameterName) override;
AZ::Vector3 GetVector3Value(const AZStd::string& parameterName) override;
bool IsParameterUsed(const AZStd::string& parameterName) override;
void SetBoolValue(const AZStd::string& parameterName, bool value) override;
void SetEntityIdValue(const AZStd::string& parameterName, AZ::EntityId value) override;
void SetLinearValue(const AZStd::string& parameterName, float value) override;
void SetLinearValuePair(const AZStd::string& parameterName, const AngleLimitsFloatPair& valuePair) override;
void SetVector3Value(const AZStd::string& parameterName, const AZ::Vector3& value) override;
// AzFramework::EntityDebugDisplayEventBus overrides ...
void DisplayEntityViewport(
const AzFramework::ViewportInfo& viewportInfo,
AzFramework::DebugDisplayRequests& debugDisplay) override;
EditorJointConfig m_config;
};
} // namespace PhysX