diff --git a/RoomEscape/Config/DefaultInput.ini b/RoomEscape/Config/DefaultInput.ini new file mode 100644 index 0000000..442f548 --- /dev/null +++ b/RoomEscape/Config/DefaultInput.ini @@ -0,0 +1,50 @@ + +[/Script/Engine.InputSettings] +-AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) +-AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) +-AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) +-AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) +-AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) +-AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) ++AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MouseWheelAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_LeftTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_RightTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MotionController_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MotionController_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MotionController_Left_TriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MotionController_Left_Grip1Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MotionController_Left_Grip2Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MotionController_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MotionController_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MotionController_Right_TriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MotionController_Right_Grip1Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MotionController_Right_Grip2Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_Special_Left_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_Special_Left_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) +bAltEnterTogglesFullscreen=True +bF11TogglesFullscreen=True +bUseMouseForTouch=False +bEnableMouseSmoothing=True +bEnableFOVScaling=True +FOVScale=0.011110 +DoubleClickTime=0.200000 +bCaptureMouseOnLaunch=True +DefaultViewportMouseCaptureMode=CapturePermanently_IncludingInitialMouseDown +bDefaultViewportMouseLock=False +DefaultViewportMouseLockMode=LockOnCapture ++ActionMappings=(ActionName="Grab",Key=LeftShift,bShift=False,bCtrl=False,bAlt=False,bCmd=False) ++ActionMappings=(ActionName="Grab",Key=RightMouseButton,bShift=False,bCtrl=False,bAlt=False,bCmd=False) +bAlwaysShowTouchInterface=False +bShowConsoleOnFourFingerTap=True +DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks +ConsoleKey=None +-ConsoleKeys=Tilde ++ConsoleKeys=Tilde + + diff --git a/RoomEscape/Content/NewMap.umap b/RoomEscape/Content/NewMap.umap index fd05966..48a8e9e 100644 Binary files a/RoomEscape/Content/NewMap.umap and b/RoomEscape/Content/NewMap.umap differ diff --git a/RoomEscape/Content/NewMap_BuiltData.uasset b/RoomEscape/Content/NewMap_BuiltData.uasset index 9344f40..f39013e 100644 Binary files a/RoomEscape/Content/NewMap_BuiltData.uasset and b/RoomEscape/Content/NewMap_BuiltData.uasset differ diff --git a/RoomEscape/Source/RoomEscape/Grabber.cpp b/RoomEscape/Source/RoomEscape/Grabber.cpp index 137b9e7..2fc1e74 100644 --- a/RoomEscape/Source/RoomEscape/Grabber.cpp +++ b/RoomEscape/Source/RoomEscape/Grabber.cpp @@ -3,6 +3,8 @@ #include "Grabber.h" #include "Engine/World.h" #include "GameFramework/Actor.h" +#include "PhysicsEngine/PhysicsHandleComponent.h" +#include "Components/InputComponent.h" #include "Public/DrawDebugHelpers.h" #define OUT @@ -22,6 +24,27 @@ void UGrabber::BeginPlay() { Super::BeginPlay(); UE_LOG(LogTemp, Warning, TEXT("Grabber beginPlay")); + + ///Look for attached physics handle + PhysicsHandle = GetOwner()->FindComponentByClass(); + if (PhysicsHandle) { + + } else { + UE_LOG(LogTemp, Error, TEXT("%s has no PhysicsHandle"), *(GetOwner()->GetName())); + } + + InputComponent = GetOwner()->FindComponentByClass(); + if (InputComponent) { + UE_LOG(LogTemp, Warning, TEXT("%s has a InputHandle"), *(GetOwner()->GetName())); + InputComponent->BindAction("Grab", IE_Pressed, this, &UGrabber::Grab) + } else { + UE_LOG(LogTemp, Error, TEXT("%s has no InputHandle"), *(GetOwner()->GetName())); + } + +} + +// Raycast and grab what is in reach +void UGrabber::Grab(){ } diff --git a/RoomEscape/Source/RoomEscape/Grabber.h b/RoomEscape/Source/RoomEscape/Grabber.h index f068888..a2aacd5 100644 --- a/RoomEscape/Source/RoomEscape/Grabber.h +++ b/RoomEscape/Source/RoomEscape/Grabber.h @@ -4,6 +4,8 @@ #include "CoreMinimal.h" #include "Components/ActorComponent.h" +#include "PhysicsEngine/PhysicsHandleComponent.h" +#include "Components/InputComponent.h" #include "Grabber.generated.h" @@ -13,19 +15,16 @@ class ROOMESCAPE_API UGrabber : public UActorComponent GENERATED_BODY() public: - // Sets default values for this component's properties UGrabber(); + virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; protected: - // Called when the game starts virtual void BeginPlay() override; -public: - // Called every frame - virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; - private: float Reach = 100.f; - + UPhysicsHandleComponent* PhysicsHandle = nullptr; + UInputComponent* InputComponent = nullptr; + void Grab(); // Raycast and grab what is in reach };