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!!