Line trace wont rotate

hello, i am very nooby at using ue4. i’m creating my first ever project and in my endeavors I’ve been trying to do some line tracing.

this is how my blueprint is set up.

it just doesn’t seem to rotate even though the capsule does? it seems to be stuck in the direction of player start

if anyone could explain this to me in the SIMPLEST terms or even create a blueprint showing me where my error is, i would really appreciate it

1 Like

Hi, your capsule component is world aligned by default so it will always be facing the same direction.

You will need to use the actor rotation. So… GetActorRotation…

Hope that helps! =)

P.S.(But just use the Actor rotation) There are three options for the pitch yaw and roll of the capsule. Only Yaw is set to True by default because it’s oriented around Z is up logic and there isn’t a need to rotate the capsule along the other two axis’s unless your game doesn’t stay in Z is up logic. Setting the other two to True will allow the rotation of the capsule in the editor.

thank you for your reply, i done what you said and exchanged the world rot for actor rot

55565-actor+rotation.jpg

i’m not sure if and or what i need to attach to actor rotation because it’s still the same… there probably something really obvious i’m missing but i’m just exhausted with this…

its funny i can blueprint an ai wonder, pawn sense move to but cant draw a line that rotates “sigh”

thank you for your help though

1 Like

Yes, you have some of your nodes mixed up, Here check this out and see if it helps:
55552-

thank you so much, i realize now you have shown me! i really appritiate it

Awesome.

If you would accept the answer and/or upvote, I would appreciate the karma =)
Enjoy your Gamedev!

1 Like

For further clarification for anyone else who wants to change the rotation of a line trace:

The easiest way to do this is to add an arrow component to your scene. This gives us a reference point from which to grab rotation information. The arrow should be pointing “forward” relative to your mesh. (usually down X)

As with a normal line trace, start by getting the World Location of the Arrow Component and plug this into the Start of your line trace. Then you get the forward vector of the Arrow Component and multiply this by your trace length (distance you want the line to extend). You then drag a line off your Arrow Component and type “rot” and add a “Add World Rotation” node. In my example I’m rotating 90 degrees on the Y axis so that the line fires to the right instead of forward. You then connect the Add World Rotation node to your line trace and of course call the AddWorldRotation node from whatever you’re using to call your line trace. E key for example. In my screenshot its not connected to anything but it needs to be in order to work.

That’s it. Really simple way to change the rotation of your line trace. You can even call multiple line traces at once using a sequence to create a radial trace. Not exactly sure how system intensive it is to call multiple line traces at once, but it should be fine.

5 Likes

Thank you very much, that helped me a lot!

1 Like