FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál
  • ✇Recent Questions - Game Development Stack Exchange
  • How can I find the opposite angle and position of the camera?Boneco Sinforoso
    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: I found a value close to its position and opposite angulation, but not really the correct value: 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: IN GAME: As you can see, the inversion is not 1
     

How can I find the opposite angle and position of the camera?

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.

❌
❌