0
\$\begingroup\$

In this project I have a character and a camera that follows it.

The camera has a position relative to the character that was defined as (x = 0, y = 0, z = 0) and also its rotation:

enter image description here

I found a value close to its position and opposite angulation, but not really the correct value:

enter image description here

By pressing the Q key, the camera shifts to the position and angulation that I have discovered. Releasing the Q key, the camera returns to its initial position:

enter image description here

IN GAME:

enter image description here

As you can see, the inversion is not 100% correct.

One of the ways I thought, is a way where I take this relative value from the camera (x = 0, y = 0, z = 0) and with that:

enter image description here

I put the character's mesh at the location (x = 0, y = 0, z = 0) at the level and so, as the camera will be (for example) x = -250, y = 0, z = 300, it's just I invert the value of x. The angulation is simpler to deduce, but it would be interesting for me to also derive its relative value (0, 0, 0).


EDIT 1 (Attempt that I did and that almost worked out)

By clicking the down arrow to the left of the values, you can select whether you want the variable to be Relative or World (I did not know that):

enter image description here

Before it was all 0, it now has a value:

enter image description here

Taking the minus sign, I was able to figure out the opposite position:

enter image description here

New position:

enter image description here

It happens that at the time of changing the angulation from relative to absolute, a conversion is not made:

enter image description here

I can not get absolute value equivalent to relative. What happens is that the value 0, 0, 0 is also defined for the absolute rotation. In the image below the camera was exactly in the same position as the VR camera:

enter image description here

I discovered by trial and error the equivalent angulation between relative and absolute:

enter image description here

BLUEPRINT:

enter image description here

The code works correctly, but I feel that again I did not get exactly the position and opposite angles.

Here are some screenshots of the game:

Local X with NORMAL CAMERA:

enter image description here

Local X with OPPOSITE CAMERA:

enter image description here

Local Y with NORMAL CAMERA:

enter image description here

Local Y with OPPOSITE CAMERA:

enter image description here

Note that in the opposite camera you can see the end of the world (sky) from wherever you are, which is not the case with the normal camera. I noticed this, and so, I think once again I did something wrong.

\$\endgroup\$
6
  • \$\begingroup\$ What was wrong with the relative value approach? \$\endgroup\$
    – Alex F
    May 12, 2019 at 0:36
  • \$\begingroup\$ With this value of 0, 0, 0 I have no idea of ​​the real distance between the camera and the character. Putting this value as absolute I will be able to define its location and opposite angulation. \$\endgroup\$ May 12, 2019 at 0:40
  • \$\begingroup\$ If you know the camera's absolute position, and the character's absolute position, then you know the camera's position relative to the character; just subtract. \$\endgroup\$
    – Alex F
    May 12, 2019 at 0:56
  • \$\begingroup\$ Apparently I managed to figure out the position, but again I get bogged down with the angles. I edited the question. Take a look. \$\endgroup\$ May 13, 2019 at 22:48
  • \$\begingroup\$ Since the camera is attached to the spring arm, you're changing the position relative to that, not the character. If the spring arm positions don't change, this shouldn't affect the camera but there is a chance it will. \$\endgroup\$
    – Stephen
    May 14, 2019 at 11:29

1 Answer 1

0
\$\begingroup\$

To get the correct result, I had to make the Spring Arm simpler/understandable.

Initial Spring Arm:

enter image description here

Modified Spring Arm:

enter image description here

I set the location and angulation of the normal camera:

enter image description here

I recommend setting all values ​​of rotation to 0 after finding the inverse position of the camera:

enter image description here

I recommend furthermore only modify the values ​​by the details tab. Do not use the E shortcut and set the rotation with the mouse (errors happened to me):

enter image description here

Then just find the reverse rotation in the necessary axes:

enter image description here

  • X axis, for the camera does not stand upside down.

  • Y axis, in this case is the inverse angulation at 45º.

Superimposed normal and inverse camera images:

enter image description here

See that the character remains in the same place in the two images, so the location and angulation were defined correctly.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .