Hello, I would not bother to ask but I’m really stuck for now.
I try to make some kind of bullet penetration and was thinking about how it would be the best.
So I stumbled across bStartPenetrating and wanted to make so that a trace would start inside the wall
and would end at the impact point and just fire another one with a starting point of 1unit deeper till bStartPenetrating doesn’t return true anymore to get the depth of the wall.
But bStartPenetrating ALWAYS returns true for me. Help me please
Are you setting the trace to ignore the actor you’re doing the trace in? It might be hitting ‘itself’, doesn’t look like you’re ignoring any actors in that code snippet.
Just letting you know of two handy tools to use for this sort of issue:
Trace Tag: That name you provide for each trace or overlap isn’t just for show – you can use it with the TraceTag console command to see what’s happening in the game world. In your case, TraceTag ShootTrace should let you see the trace as it’s happening in realtime.
Collision Analyzer: TraceTag is handy and all, but it’s not very useful for camera-based traces and it can make your frame rate plummet from too many draw calls if you have a lot of traces happening. The collision analyzer is invoked through the console command canalyzer, which will let you record and see a history of traces based on tag, along with cursory information about what they hit, etc.
I think I have to reset the hitdata somehow… for some reason is the return of HitData.GetComponent()->GetName() the same every time even if the trace doesn’t hit anything anymore…
Doing a line trace in a loop like that looks like a recipe for potential performance disaster. I don’t really see why it would be necessary either. If you could explain fully what it is you’re trying to accomplish, there may be a better way.
By the way, there is a function provided for GetActorRotation().Vector(); use GetActorForwardVector().