Hello,
my Code compiles perfectly and it should be correct, but always when I hit play the engine crashes.
Does someone have an Idea what it could be in unreal.I already had a crash like this and it was that Pressureplate wasn’t editanywhere and also ATriggerVolume wasn’t chosen under Pressureplate in unreal.
Could you post the code in your Grabber.cpp file? It might help us see the problem.
Sorry for the long waiting
Thank You
Hello, sorry to hear about your issues. My First quick question is are you using commas in UE Details panel for Open Angle and Door Close delay? -60,0 and 0,79. That would cause an issue, but perhaps not a crash. I’m new to this too. What version of UE4 are you using. I’ve been finding many of my issues are the ‘include what you use type’. Could I see your header file as well?
Good Luck
My Unreal Version 4.20.2
Hello, it’s been a while, but I can answer your questions.
I was using commas in the Details Panel in OpenDoor. I didn’t try it again, because I searched for the problem so much and nobody could answer me here. I hope you have an idea how to fix it.
Good Day
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "Engine.h"
#include "Components.h"
#include "CoreMinimal.h"
#include "PhysicsEngine/PhysicsHandleComponent.h"
#include "Components/ActorComponent.h"
#include "Components/InputComponent.h"
#include "Grabber.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BUILDINGESCAPE_API UGrabber : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UGrabber();
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
//How far ahead of the player can we reach in cm
private:
float Reach = 100.f;
UPhysicsHandleComponent* PhysicsHandle = nullptr;
UInputComponent* InputComponent = nullptr;
// Ray-cast and grab
void Grab();
// Called when grab key is released
void Release();
void FindPhysicsHandleComponent();
void SetupInputComponent();
const FHitResult GetFirstPhysicsBodyInReach();
// Returns current end of reach line
const FVector GetReachLineEnd();
// Returns current end of reach line
const FVector GetReachLineStart();
};
I fixed it myself. I forgot to add a Physics Handle Component to DefaultPawn
Stuff like this is really easy to find with the debugger. If you got trouble next time, try using the debugger. Here it then crashed because your PhysicsHandle was null. If you attach the debugger it will stop before it crashes, at the position where it crashes. Normally you can then see if one of your attributes is null and work from there on.