satoox
(satoox)
August 1, 2019, 6:18pm
1
Added this Code to the .h:
private:
UPROPERTY(VisibleAnywhere)
float OpenAngle = 90.0f;
UPROPERTY(EditAnywhere)
ATriggerVolume* PressurePlate;
UPROPERTY(EditAnywhere)
AActor* ActorThatOpens; //Pawn inherits from actor
and this to the .cpp:
void UOpenDoor::OpenDoor()
{
AActor* Owner = GetOwner();
FRotator NewRotation = FRotator(0.0f, -160.0f, 0.0f);
Owner->SetActorRotation(NewRotation);
}
// Called every frame
(line 42) void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// ...
if (PressurePlate->IsOverlappingActor(ActorThatOpens))
{
OpenDoor();
}
}
Firefly74
(Firefly74)
August 2, 2019, 7:37am
2
Hello,
that code might cause an issue if you have a door without a pressure plate set up.
i would change the tick code to something like this :
if (PressurePlate && ActorThatOpens && PressurePlate->IsOverlappingActor(ActorThatOpens))
{
OpenDoor();
}
Thus we only check overlap is setup is complete
if it does still crash, please share the log so we can debug it better !
satoox
(satoox)
August 2, 2019, 2:26pm
3
the engine has stopped crashing but when overlapped with trigger volume event is not triggered
Firefly74
(Firefly74)
August 2, 2019, 2:32pm
4
because either "PressurePlate " isn’t setted up or "ActorThatOpens "
you can setup presure plate inside on the map, but for the actor variable, i don’t know what you planed.