Modification for tunnel vision

Hello guys i just wanted to share a simple modification that i did for the tunnel vision.

If you are walking straight the tunnel will maintain the radius given by the curve , but if you walk in diagonal it will give you a bigger Radius.

void AVRCharacter::UpdateBlinkers()
{
	if (RadiusVsVelocity  == nullptr) return;

	float Speed = GetVelocity().Size();
	float Radius = RadiusVsVelocity->GetFloatValue(Speed);

	

	FVector2D Centre = GetBlinkerCentre();
	BlinkerMaterialInstance->SetVectorParameterValue(TEXT("Centre"), FLinearColor(Centre.X, Centre.Y, 0));



	if (Centre.X > .6 || Centre.X < .4) {
		BlinkerMaterialInstance->SetScalarParameterValue(TEXT("Radius"), Radius*1.9);
	}
	else {
		BlinkerMaterialInstance->SetScalarParameterValue(TEXT("Radius"), Radius);
	}
}

Greetings!!

1 Like

Nice idea! Iā€™d suggest introducing another curve for getting the radius modifier vs Centre.X, or at least some means of smoothing. Otherwise you might get unpleasant jumps between plain radius and 1.9 * radius when Centre.X grows and shrinks through your thresholds from one frame to another.

Privacy & Terms