Linetrace. Rotate forward vector.

Hi guys :slight_smile:

How we can rotate linetrace sended from capsule side by angle alpha as in picture?

Trace are sended from little green sphere on capsule side.
Cause i need rotate trace up and down by some alpha value, my naive approach was: rotatevector and put my alpha value to Y input. That doesnt work, cause trace will move up/down when capsule will rotate.

@Alexander.L Are these objects in a BP? Then just don’t connect the green dot component to the capsule component ( so when the capsule rotates, the green dot does not ).

Otherwise you’ll need to find then endpoint of the trace using getforwardvector and multiple by the length ( as in the many youtube tutorials ).

I do not know if it helps you but I do something similar in a function. remove the part where I randomize the accuracy and use only the pitch (alpha in degrees). that should work

You have forward vector.
Get also right vector to that capsule.
Then use this: [rotate vector around axis]
https://api.unrealengine.com/INT/Blu…xis/index.html

In vector is your forward vector, axis is right vector.

Yeah, thank you guys :slight_smile: I was solve the problem quite after the post (as it usually happens) :rolleyes:
DrawDebugCoordinateSystem - helps a lot, cause clearly show why i dont rotate forward vector properly )