Download

How can I get the viewport camera position and rotation angle relative to other axes?

Hi.
I want to make a raycast in my game, but to do this, I need to know the position where the viewport camera is located and the angle of its deviation relative to the XYZ axes.

I didn’t find such a function in viewport, how can I do this?

Hi man,
maybe you are searching for the “make relative transform” ?

No.
I want to be able to get data about what point I’m looking at. to do this, I want to make a raycast in the direction where the viewport is looking, and for the raycast, I need to know the position of the viewport camera and the angles relative to the XYZ axes.

You can access any actor by reference,
and get the component inside, and their world-location and rotation, but for raycast you can use the Forward vector of the camera,
the vector is just long 1 unit, so i multiply it for having a ray long enough to reach the floor.

OK, problem solved, thanks for your help!