So i’ve been using line traces for objects to fire from the player view, hit a target, then fire another visible line trace along the surface normal away from the target hit. so for example I fire, hit a wall, and another trace comes out of the wall perpendicular to it.
the problem I’ve noticed is that while near the world origin this works well:
As you get further away from (0,0,0), the lines start to get scewed:
I’ve got quite a large map, so this is very noticeable. I’ve tried using Impact normal and normal, and been able to recreate this in a blank FPS template level. It doesn’t make any difference what angle I originally hit the wall at. This is what I’m using:
Thank you for the report. I was easily able to reproduce this issue and I’ve logged it as JIRA UE-20678. Our developers will be investigating the issue and we will post here with updates as we have them.
I notice in your BP you use the hit result, regardless of whether a hit was found or not (the ‘Return value’ pin). If you only do the second trace when you get a hit, does that change anything?
I’ve managed to add a tempory fix, by simply moving the world origin to the players location the first time its done. This obviously isn’t ideal (it messes with the lighting a bit, and potentially some other features), but it works well enough for now.
I’m afraid I’m not really sure what you are trying to do. The normal is a direction vector, indicating the surface normal at the point of impact, I’m not sure what a trace from the impact point to (normal * 10000) is really indicating? Do you mean (impact point + (normal *10000)), that would be a point projected away from the impact location by the surface normal.
Has this been fixed yet? I’m trying to do some really simple calculations using impact normal and after banging my head against the wall and debugging I realized the engine is in fact outputting bad values for the impact normal vectors.
Hi, I’m not sure if it’s actually a problem, I realised (well, JamesG pointed out) I should have done (impact point + (normal *10000)) to get the line to come out perpendicular.
I know for a fact mathematically it is not returning the correct values, I had to set up a tolerance to get it to work with c++.
I’m simply passing the normal vector through c++ blueprint functions so the normal vectors should be <1,0,0>,<0,1,0>,<0,0,1> and the negatives, but they are not.