I have two doors like gate

I have two doors and Both of them opened in a different direction
Any help?

The code

void UopenDoorR0::BeginPlay()
{
	Super::BeginPlay();


	InitialYaw = GetOwner()->GetActorRotation().Yaw;
    CurrentYaw = InitialYaw;
	
	TargetYaw =90.f + InitialYaw;

	
}


// Called every frame
void UopenDoorR0::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

	UE_LOG(LogTemp,Error,TEXT("%s"),*GetOwner()->GetActorRotation().ToString());
	UE_LOG(LogTemp,Warning,TEXT("%f"),GetOwner()->GetActorRotation().Yaw);


    CurrentYaw = FMath::FInterpTo(CurrentYaw, TargetYaw, DeltaTime, 2);
	FRotator DoorRotation= GetOwner()->GetActorRotation();
	DoorRotation.Yaw = CurrentYaw;
	GetOwner()->SetActorRotation(DoorRotation);

}

Cant you just rotate wrong direction opening door “upside down” to make it open to right direction?

This does not work because it destroy the design
and the code dependent on “Z” and it is not affected

Annotation 2020-05-22 232242

Yes, i was dumb, realised later that it has that window there =D
You actually only need to pass to other door rotation as negative, then it will rotate opposite direction.
If you move on the course for now, you will find ways to do this, as now your rotation is “hard coded”.

I didn’t notice that there are three doors in that first screenshot so was confused as to what the problem was. Seemed working as intended :stuck_out_tongue:

I just wanted to make two doors in one wall that opened in the same direction
I think I will solve this later

OK thanks

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms