add FSGDebugCube
This commit is contained in:
@@ -25,7 +25,8 @@ This is a minor release focusing mainly on bringing OpenXR-compatible hand track
|
||||
- Added USGVirtualHandComponent::OnHandVisibilityChanged() event in order to notify other components/actors whenever the virtual hand mesh appears or disappears (for example, this could happen when a glove is connected/disconnected).
|
||||
- Added USGWristTrackerComponent::GetMotionControllerData().
|
||||
- Added USGWristTrackerComponent::OnWristDeviceVisualTypeChanged event in order to be able to notify other components/actors whenever the wrist-tracking device switches between hand tracking or motion controllers.
|
||||
- Added the SenseGloveDebugKismet module in order to allow drawing of debugging gizmos and virtual hands from Blueprint.
|
||||
- Added FSGDebugCube.
|
||||
- Added the SenseGloveDebugKismet module in order to allow drawing of debugging, cubes, gizmos, and virtual hands from Blueprint.
|
||||
- Added a new static Draw() method overload to DebugGizmo which allows passing an FQuat instead of a FRotator.
|
||||
- Added FSGEngineUtils.
|
||||
- Introduced the FSGInitializationSettings in order to control how the plugin is initialized.
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* @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
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "SGDebug/SGDebugCube.h"
|
||||
|
||||
#include "DrawDebugHelpers.h"
|
||||
#include "Engine/World.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "Math/Color.h"
|
||||
#include "UObject/Object.h"
|
||||
|
||||
void FSGDebugCube::Draw(const UWorld* World, const FVector& Location, const FQuat& Rotation,
|
||||
const FSGDebugCubeSettings& Settings)
|
||||
{
|
||||
const float LifeTime = UGameplayStatics::GetWorldDeltaSeconds(World) * Settings.LifeTimeModifier;
|
||||
DrawDebugBox(World,
|
||||
Location,
|
||||
Settings.Extent,
|
||||
Rotation,
|
||||
Settings.Color,
|
||||
Settings.bPersistentLines,
|
||||
LifeTime,
|
||||
Settings.DepthPriority,
|
||||
Settings.Thickness);
|
||||
}
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "Math/Color.h"
|
||||
#include "UObject/Object.h"
|
||||
|
||||
#include "SGDebug/SGDebugCube.h"
|
||||
#include "SGDebug/SGDebugGizmo.h"
|
||||
|
||||
void FSGDebugVirtualHand::Draw(const UWorld* World,
|
||||
@@ -64,17 +65,7 @@ void FSGDebugVirtualHand::Draw(const UWorld* World,
|
||||
|
||||
if (Settings.DrawingMode == ESGDebugVirtualHandDrawingMode::CubicJoints)
|
||||
{
|
||||
const float LifeTime = UGameplayStatics::GetWorldDeltaSeconds(World)
|
||||
* Settings.DebugCubicHandSettings.LifeTimeModifier;
|
||||
DrawDebugBox(World,
|
||||
HandKeyPosition,
|
||||
Settings.DebugCubicHandSettings.Extent,
|
||||
HandKeyRotation,
|
||||
Settings.DebugCubicHandSettings.Color,
|
||||
Settings.DebugCubicHandSettings.bPersistentLines,
|
||||
LifeTime,
|
||||
Settings.DebugCubicHandSettings.DepthPriority,
|
||||
Settings.DebugCubicHandSettings.Thickness);
|
||||
FSGDebugCube::Draw(World, HandKeyPosition, HandKeyRotation, Settings.DebugCubicHandSettings);
|
||||
}
|
||||
else if (Settings.DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* @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 "Containers/Array.h"
|
||||
#include "Math/Rotator.h"
|
||||
#include "Math/Vector.h"
|
||||
|
||||
#include "SGSettings/SGDebugCubeSettings.h"
|
||||
|
||||
class SENSEGLOVEDEBUG_API FSGDebugCube final
|
||||
{
|
||||
public:
|
||||
static void Draw(
|
||||
const UWorld* World,
|
||||
const FVector& Location, const FQuat& Rotation,
|
||||
const FSGDebugCubeSettings& Settings);
|
||||
|
||||
static FORCEINLINE void Draw(
|
||||
const UWorld* World,
|
||||
const FVector& Location, const FRotator& Rotation,
|
||||
const FSGDebugCubeSettings& Settings)
|
||||
{
|
||||
Draw(World, Location, Rotation.Quaternion(), Settings);
|
||||
}
|
||||
|
||||
public:
|
||||
FSGDebugCube() = delete;
|
||||
virtual ~FSGDebugCube() = delete;
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @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
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "SGDebugKismet/SGDebugCubeKismetLibrary.h"
|
||||
|
||||
#include "SGDebug/SGDebugCube.h"
|
||||
|
||||
inline void USGDebugCubeKismetLibrary::Draw_W_L_FQuat_R_S(
|
||||
UObject* WorldContextObject,
|
||||
const FVector& Location, const FQuat& Rotation, const FSGDebugCubeSettings& Settings)
|
||||
{
|
||||
ensureAlwaysMsgf(WorldContextObject, TEXT("Invalid world context object!"));
|
||||
|
||||
FSGDebugCube::Draw(WorldContextObject->GetWorld(), Location, Rotation, Settings);
|
||||
}
|
||||
|
||||
inline void USGDebugCubeKismetLibrary::Draw_W_L_FRotator_S(
|
||||
UObject* WorldContextObject,
|
||||
const FVector& Location, const FRotator& Rotation, const FSGDebugCubeSettings& Settings)
|
||||
{
|
||||
ensureAlwaysMsgf(WorldContextObject, TEXT("Invalid world context object!"));
|
||||
|
||||
FSGDebugCube::Draw(WorldContextObject->GetWorld(), Location, Rotation, Settings);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @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 "SGKismet/SGBlueprintFunctionLibrary.h"
|
||||
#include "SGDebug/SGDebugCube.h"
|
||||
|
||||
#include "SGDebugCubeKismetLibrary.generated.h"
|
||||
|
||||
class USGDebug;
|
||||
|
||||
UCLASS(meta=(ScriptName = "SenseGloveDebugCubeKismetLibrary"))
|
||||
class SENSEGLOVEDEBUGKISMET_API USGDebugCubeKismetLibrary final : public USGBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable, DisplayName="Draw", Category="SenseGlove | Debug | Cube",
|
||||
meta=(WorldContext="WorldContextObject"))
|
||||
static void Draw_W_L_FQuat_R_S(
|
||||
UObject* WorldContextObject,
|
||||
const FVector& Location, const FQuat& Rotation,
|
||||
const FSGDebugCubeSettings& Settings);
|
||||
|
||||
UFUNCTION(BlueprintCallable, DisplayName="Draw", Category="SenseGlove | Debug | Cube",
|
||||
meta=(WorldContext="WorldContextObject"))
|
||||
static void Draw_W_L_FRotator_S(
|
||||
UObject* WorldContextObject,
|
||||
const FVector& Location, const FRotator& Rotation,
|
||||
const FSGDebugCubeSettings& Settings);
|
||||
};
|
||||
Reference in New Issue
Block a user