UE2 - UT2kX TraceActors

  • 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.

Ominae392

New Member
Feb 26, 2008
13
0
1
I've been having trouble with the TraceActors loop not coming up with a successful trace.

Code:
foreach TraceActors (class'Actor', TraceActor, HitLocation, HitNormal, CameraEnd, CameraLocation)
	{
		if ((Pawn != None && TraceActor == Pawn) || (TraceActor.IsA('Volume') && !TraceActor.IsA('TriggerVolume')))
			continue;
		else if(TraceActor.IsA('TriggerVolume')) {
			bTriggerVolume = true;
			break;
		} else {
			break;
		}
	}

Here is the weird part. I can be pointing at the 'triggervolume' I'm trying to find and the trace will be a success. A few seconds later the trace fails and I haven't done anything. Just to make I dumped all of the input variables to TraceActors and none of them change between finding my volume and not finding it.

Is there an issue with TraceActors I don't know about?
 

Cody Lavery

New Member
Jan 26, 2008
12
0
0
Utah
whats your error, what line?

Code:
foreach TraceActors (class'Actor', TraceActor, HitLocation, HitNormal, CameraEnd, CameraLocation)
	{
		if (
                   (   Pawn != None && TraceActor == Pawn  )
                   || (  TraceActor.IsA('Volume') && !TraceActor.IsA('TriggerVolume')   )    
                            )
			continue;
		else if(TraceActor.IsA('TriggerVolume')) {
			bTriggerVolume = true;
			break;
		} else {
			break;
		}
	}

i assume this is done in the player controller class...

i dont understand the logic of the first if condition, why look for something you dont want? it seems like your only declaring a bool out of this, why not just do it this way.

Code:
foreach TraceActors (class'Actor', TraceActor, HitLocation, HitNormal, CameraEnd, CameraLocation)
	{
              if(TraceActor.IsA('TriggerVolume')) {
			bTriggerVolume = true;
			break;
		} else {
			break;
		}
	}
 

Ominae392

New Member
Feb 26, 2008
13
0
1
As I stated in my first post the error is that TraceActors seems to intermittently find my triggervolume even just standing still.

The reason for the extra conditionals was for future extensibility. Yes you could do it your way. But it doesn't really matter because in either case the TraceActors is causing me problems.

And just for clarity let me reiterate that the variables going in to TraceActors (cameraend & cameralocation) will stay exactly the same and one second I'll have a successful trace, a few seconds later I won't.
 

Ominae392

New Member
Feb 26, 2008
13
0
1
@eblade ? Not sure I understand the question.

For the problem at hand assume I have a map with nothing but a floor, skybox, spawn pt, and a triggervolume. There is a vector from the cursor position directly out in to the scene with a trace distance of sufficient size. I want to know if that vector hits my triggervolume. As I've said I know the calculations work and I know that some of the time the volume is detected. It's when I no longer see the volume with no apparent reason that I begin to wonder.