Download

Camera Line Tracing Issue

I’ve decided to delve back into UE4 after a rather lengthy break and have decided to further familiarize myself with replication, so I thought making a vehicular combat prototype of sorts would work nicely as a starting point. It’s a simple concept, really. Vehicles with one or more turrets mounted on them, aiming towards your cursor target.

Simple, right? Or so I thought, I can’t even get the line tracing working properly. I’ve done line tracing before for weapons and procedural mesh slicing, so I’m fairly acquainted with it I’d say. But I’ve run into an issue now which I believe is due to the camera being attached to a spring arm?

I’m actually not quite sure how to explain what’s going on, so you’re probably just better off watching this video(Epic please add embedding support for Streamable, it’s an amazing platform for hosting short video clips. Far better than YouTube).

For demonstration purposes I’ve attached a big, ugly decal at the impact location. It seems to work as intended when I enter debug camera mode - so something fishy is going on but I’ve been up for almost 24 hours now and I’m sure I’m overlooking something really silly.

So I’m posting this in hopes that some kind soul out there can help me figure out what I’m missing here, or why it’s behaving like it does.

How are you doing the rotation of the spring arm?

I would set the spring arm to Use Control Rotation, then have axis events to add control rotation. Is this what you are doing?

Aye, my Spring Arm is set up to use Use Pawn Control Rotation. And I use the MouseX & MouseY events to add controller yaw & pitch input.

So it looks something like the below?

93adb7d946ad48fa969e60a689c9e4ae.png

What else have you modified compared to the default advanced vehicle template?

Aye, that’s exactly how I’ve got it set up. As far as I can recall I haven’t really touched anything. I’ll start from scratch and see if that works.

Edit:

So I started a new project and it worked right away, I’ve absolutely no clue what’s gone wrong with the other project. I’ve compared them but can’t spot anything different. :confused:

Yeah, I’ve had weird bugs with Spring Arms that I haven’t been able to consistently reproduce, seems to cause issues when one un-attaches a component that was attached to the spring arm with a relative offset. If you moved anything around in the component list and then moved them back, it might have caused something. At least it’s working now!