Forward Vector Points in Wrong Direction
Okay, so I'm trying to do line traces in a third-person 3D game (UE 4.8.3) using forward, up and right vectors but none of them actually point forward, up or right relative to the actor. They all point at the same absolute world location (no matter the actor rotation), rather than a location that's relative to the character's rotation or location. I'm assuming that it's the world origin but I'm not sure. (When I follow the direction of the line traces with my character and get to the world location it's pointing to, it starts pointing straight downward.)
I've tried using GetActorForwardVector, as well as using GetForwardVector on the Capsule Component and the character mesh and other components parented to my character but all of those result in the same wrong direction. I've also checked whether my Capsule Component, for whatever reason, might not be rotating with the character but it is and I'm kind of at my wit's end. Am I using these vectors wrongly or making some stupid mistake? Is this a bug? I have no idea. I'm almost certain that I've used forward vectors before in exactly this way and it worked fine.
This is my Movement Input Blueprint. I've taken out some of the clutter but even with this simplified setup I still get the results mentioned above. (I've disabled the TurnRate and LookUpRate inputs as my camera is supposed to be locked behind the character):
This is the line trace setup I'm using to test the error. I'm using the world location of EdgeCheck (which is a capsule attached to my character) because, otherwise, it'd just draw the line in the world origin, which appears to be beneath the floor, as opposed to from the character to the world origin. So we wouldn't even be seeing the line at all:
And this is what the line trace looks like in-game. The character is rotated differently in each of the images but still the line trace always goes into exactly the same absolute direction:
I've also found this old thread which appears to be talking about either the same or at least a similar problem but it looks like it was assumed that that was just a bug from the beta version so it got closed. Still, I think it doesn't hurt to link it here just in case:
asked Aug 19 '15 at 03:32 AM in Blueprint Scripting
Yes, it's doing exactly what you want it to do in your nodes. You aren't projecting the line trace. Really, all you need to do in order to get your current setup to work is from the forward vector, add your trace distance to the X and then plug it in. This still may not project correctly depending on how you have your vectors setup on your character though. A transform direction node may be needed but attempt what I mentioned above and if it's still not going "forward" exactly how you are facing each time then I will help you solve it further, but the aforementioned should give you a horizontal trace regardless.
5000 in the add vector node is an arbitrary number. Put in there how ever many units you want the trace to go.
Hope this helps! If so, I would appreciate it if you could accept the answer by clicking the check mark located under the arrow keys next to the answer. When done correctly, the answer will highlight green! Any other questions just let me know.
EDIT: To expand on why your current setup isn't working like you expect. What you are doing is getting the world location of your "Edge Check" variable, which you say is your capsule and setting that as your "Start" location for the trace. Then, you simply plug in the Forward Vector of you character as the "End" location. Therefore, it simply draws a trace from your Capsule to the center of your mesh. Use the nodes as I have setup in the picture and you should be golden!
Follow this question
Once you sign in you will be able to subscribe for any updates here