UE3 - UT3 More convenient method?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Snake0391

New Member
Apr 30, 2006
8
0
0
my desk
As the title suggest, is there more convenient way of doing this? I have to do this about 100 times and I don't think I want to type that much..

Here is the code:
Code:
	if (Distance <= 200)
        {
          SPAccuracy = 0.15;
        }
        else if (Distance > 200 && Distance <= 300)
        {
          SPAccuracy = 0.1715;
        }
         else if (Distance > 300 && Distance <= 400)
        {
          SPAccuracy = 0.193;
        }
         else if (Distance > 400 && Distance <= 500)
        {
          SPAccuracy = 0.2145;
        }
         else if (Distance > 500 && Distance <= 600)
        {
          SPAccuracy = 0.236;
        }
         else if (Distance > 600 && Distance <= 700)
        {
          SPAccuracy = 0.2575;
        }
         else if (Distance > 700 && Distance <= 800)
        {
          SPAccuracy = 0.279;
        }
 
Last edited:

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Here's a thought for simplifying your if statement conditions: If a Distance is not less or equal 200 units, is there any chance it could also not be greater than 200 units?

But about really simplifying it: Try to figure out a formula that approximates the accuracy based on a distance value, e.g.:
Code:
SPAccuracy = 0.15 + 0.000215 * (FClamp(Distance, 200, 800) - 200);