Line trace on left side camera

Is there a way to shoot line trace from camera so they could always be on the left side of the camera?
(image exaple below)

hx in advance.

Could you be more specific, im sending bluprint image.
I would appreciate it if you could point out what i have been doing wrong.

thx

Get player camera manager, from it get camera right vector, then negate it, and this will be camera left vector )

Operation -180 doing wrong things here. Right vector is a normalized direction vector. Use NegateVector operation instead.

Next, if you want to trace on some distance, you must specify it. (TraceDistance = 10000 or something)

CameraWorldLocation + TraceDistance * CameraLeftVector.

I assume you’re doing this in blueprints…

From the Camera component, you want to use the “GetRightVector” node. That will point a vector (of length 1.0) out to the right. Then you just multiply the result by -1.0 to make it point left (or -X, where X is the length you want the vector to be). To do that you want to use the “Vector * float” node.

Thanks Guys!
First solution is not working, but the second is (bluepreint below) however not as intended.

But what i’m really trying to accomplish is tracing capsule so it could always be in Y axis of the camera. But why you may ask? Well im trying to implement leaning mechanics and my character is clipping through walls and im trying to find solution for that problem.

What im trying to achive.

Blueprint

You want to get the right vector, multiply it by -100, and then ADD IT to the world location – it should go straight from GetWorldLocation into the add, no adding or multiplying anything else. The add should be plugged straight into the End pin of the trace node.

Ok thanks now it works fine.

But still capsule trace would be better, any idea how to trace it so it would always be on Y axis of the camera?

You can’t rotate the capsule trace so it will always be oriented like it is for a character standing up.

But you should be able to get what you want by doing a sphere trace. As it traces along the path, it forms a capsule shape. It’s better than a line trace because it considers radius so you will avoid leaning into things more consistently.

Actually im using sphere trace, i guess you cannot rotate it either?

A sphere looks the same no matter how it is rotated so there is no control over that. The capsule-like shape that a sphere trace creates is based on the line between start and end.

If the camera is always parallel to the ground then GetRightVector will always give a vector parallel to the ground. That will cause sphere trace to trace a capsule shape parallel to the ground. If you want it to happen on an angle then GetRIghtVector needs to return a vector that isn’t parallel to the ground. To do that you would need to either rotate the camera (local X axis) or call GetRIghtVector from a different component (like a bone/socket in the mesh component).

Thanks, it is working!