199 lines
5.9 KiB
C++
199 lines
5.9 KiB
C++
/**
|
|
* @file
|
|
*
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* (The MIT License)
|
|
*
|
|
* Copyright (c) 2020 - 2024 SenseGlove
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
* copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
*
|
|
* @section DESCRIPTION
|
|
*
|
|
*
|
|
*/
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "Components/SceneComponent.h"
|
|
#include "Engine/EngineTypes.h"
|
|
#include "Templates/UniquePtr.h"
|
|
#include "UObject/NameTypes.h"
|
|
|
|
#include "SGGrabComponent.generated.h"
|
|
|
|
class AActor;
|
|
|
|
UCLASS(Blueprintable, BlueprintType, meta=(BlueprintSpawnableComponent))
|
|
class SENSEGLOVE_API USGGrabComponent : public USceneComponent
|
|
{
|
|
GENERATED_UCLASS_BODY()
|
|
|
|
public:
|
|
static USGGrabComponent* GetGrabComponent(const AActor* Actor);
|
|
|
|
static bool IsGrabbable(const AActor* Actor);
|
|
|
|
private:
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
EAttachmentRule AttachmentLocationRule;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
EAttachmentRule AttachmentRotationRule;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
EAttachmentRule AttachmentScaleRule;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
uint8 bAttachmentWeldSimulatedBodies : 1;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
FName AttachmentSocketName;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
EDetachmentRule DetachmentLocationRule;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
EDetachmentRule DetachmentRotationRule;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
EDetachmentRule DetachmentScaleRule;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
uint8 bDetachmentCallModify : 1;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
uint8 bAffectPhysicsState : 1;
|
|
|
|
private:
|
|
struct FImpl;
|
|
|
|
struct FImplDeleter
|
|
{
|
|
void operator()(const FImpl* P) const;
|
|
};
|
|
|
|
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
|
FImplDeleter PimplDeleter;
|
|
|
|
public:
|
|
FORCEINLINE EAttachmentRule GetAttachmentLocationRule() const
|
|
{
|
|
return AttachmentLocationRule;
|
|
}
|
|
|
|
FORCEINLINE void SetAttachmentLocationRule(const EAttachmentRule InAttachmentLocationRule)
|
|
{
|
|
AttachmentLocationRule = InAttachmentLocationRule;
|
|
}
|
|
|
|
FORCEINLINE EAttachmentRule GetAttachmentRotationRule() const
|
|
{
|
|
return AttachmentRotationRule;
|
|
}
|
|
|
|
FORCEINLINE void SetAttachmentRotationRule(const EAttachmentRule InAttachmentRotationRule)
|
|
{
|
|
AttachmentRotationRule = InAttachmentRotationRule;
|
|
}
|
|
|
|
FORCEINLINE EAttachmentRule GetAttachmentScaleRule() const
|
|
{
|
|
return AttachmentScaleRule;
|
|
}
|
|
|
|
FORCEINLINE void SetAttachmentScaleRule(const EAttachmentRule InAttachmentScaleRule)
|
|
{
|
|
AttachmentScaleRule = InAttachmentScaleRule;
|
|
}
|
|
|
|
FORCEINLINE bool GetAttachmentWeldSimulatedBodies() const
|
|
{
|
|
return !!bAttachmentWeldSimulatedBodies;
|
|
}
|
|
|
|
FORCEINLINE void SetAttachmentWeldSimulatedBodies(const bool bInAttachmentWeldSimulatedBodies)
|
|
{
|
|
bAttachmentWeldSimulatedBodies = bInAttachmentWeldSimulatedBodies;
|
|
}
|
|
|
|
FORCEINLINE const FName& GetAttachmentSocketName() const
|
|
{
|
|
return AttachmentSocketName;
|
|
}
|
|
|
|
FORCEINLINE void SetAttachmentSocketName(const FName& InAttachmentSocketName)
|
|
{
|
|
AttachmentSocketName = InAttachmentSocketName;
|
|
}
|
|
|
|
FORCEINLINE EDetachmentRule GetDetachmentLocationRule() const
|
|
{
|
|
return DetachmentLocationRule;
|
|
}
|
|
|
|
FORCEINLINE void SetDetachmentLocationRule(const EDetachmentRule InDetachmentLocationRule)
|
|
{
|
|
DetachmentLocationRule = InDetachmentLocationRule;
|
|
}
|
|
|
|
FORCEINLINE EDetachmentRule GetDetachmentRotationRule() const
|
|
{
|
|
return DetachmentRotationRule;
|
|
}
|
|
|
|
FORCEINLINE void SetDetachmentRotationRule(const EDetachmentRule InDetachmentRotationRule)
|
|
{
|
|
DetachmentRotationRule = InDetachmentRotationRule;
|
|
}
|
|
|
|
FORCEINLINE EDetachmentRule GetDetachmentScaleRule() const
|
|
{
|
|
return DetachmentScaleRule;
|
|
}
|
|
|
|
FORCEINLINE void SetDetachmentScaleRule(const EDetachmentRule InDetachmentScaleRule)
|
|
{
|
|
DetachmentScaleRule = InDetachmentScaleRule;
|
|
}
|
|
|
|
FORCEINLINE bool GetDetachmentInCallModify() const
|
|
{
|
|
return !!bDetachmentCallModify;
|
|
}
|
|
|
|
FORCEINLINE void SetDetachmentInCallModify(const bool bInDetachmentCallModify)
|
|
{
|
|
bDetachmentCallModify = bInDetachmentCallModify;
|
|
}
|
|
|
|
FORCEINLINE bool GetAffectPhysicsState() const
|
|
{
|
|
return !!bAffectPhysicsState;
|
|
}
|
|
|
|
FORCEINLINE void SetAffectPhysicsState(const bool bInAffectPhysicsState)
|
|
{
|
|
bAffectPhysicsState = bInAffectPhysicsState;
|
|
}
|
|
}; |