Download

Trace won't hit my actor

Hi there. I have made a custom actor for a river, that has a static mesh component with collision.

When i do a trace (to check for footstep sounds to play) it never hits my river and instead always just hits my landscape.

Here are the collision properties of my mesh:

And here is a sample of the trace i’m doing:



HitActor = Trace(hitLocation, hitNormal, endLoc, startLoc, false,, hitInfo);


This trace appears to work find with static mesh actors and other actors spawn via script.

My goal is to allow the player to freely walk through the collision, but allow traces to hit it so i can play footstep sounds and fx’s.

Does anyone know what i’m missing? Thanks in advance.

Does the problem still happen if you make the water mesh completely solid? Make it so you should be able to stand on top of the water with Block Actors. And what happens if you change the RBChannel? I don’t trust the built-in collision channels and collision types. They never seem to work as advertised.

Oh, and what is running the trace? I’ve had absolutely zero success in getting a Pawn to get itself to appear on a trace. Try getting a different actor to make the trace.

if that’s really your Trace code, try to set the bTraceActors param to true

@Nathaniel3W an actor can never hit itself from a Trace (on the Unrealscript version anyway). it’s a convenient rule that allows you control if you want to skip tracing self (or not) based on who you call the trace from :slight_smile:

So after some testing i’m noticing that a Trace() doesn’t seem to hit the river actor, however TraceActors() does:



//This doesn't hit the river actor:
HitActor = Trace(HitLocation, HitNormal, Location - TraceDist*vect(0,0,1), Location, true,, HitInfo, TRACEFLAG_PhysicsVolumes);

//This does hit the river actor:
foreach TraceActors(class'Actor', HitActor, HitLocation, HitNormal, Location - TraceDist*vect(0,0,1), Location,,HitInfo,TRACEFLAG_PhysicsVolumes) {
    break;//Break on first iteration as we only care about the first hit actor.
}


I imagine TraceActors() is less performant than Trace() (although i’m not sure), and would rather not change many of my traces to traceActors.

Does anyone know why TraceActors() is hitting my river mesh but Trace() not?

Cheers