How do I get the opposite of a vector location.

I have a character with a camera component inside it. and the camera moves with my real life head movement.
I am trying to move the whole character BP with my head movement so the body and the head stay together.
But as the camera is a child of the character BP its causing continuous movement / double movement.
The trick is to offset do as I am doing but offset the camera location back to the body.
Here is a video of what I Mean

But I dont know how to get the opposite of the incoming x & y vectors and move the camera with them.
I tried to do a multiplier and make them -1 but it didn’t work
Anyone know How to get the opposite of the vector . EG: IF incoming vector is 200 , I need to be able to get - 200
thanks.

I don’t know about your camera setup, but recently came across this vector tutorial https://youtu.be/rsRIdE8Lfjw?t=568 perhaps this gives you an idea. However, I am not so sure if your camera setup is the most efficient way of doing it.

You need to debug your vectors. For that use linetrace (with drawaing lines enabled). Sometimes you need to draw longer line (in your case that lien may be hidden inside player mesh). However you can always hide mesh, and draw only lines. So always try to debug your code, visualize vectors, sometimes one silly mistake makes everything weird.

Now about your question:
Yes multiplying vector by -1 should reverse it. However it is very easy to confuse vectors with locations in unreal blueprint (both are same data structure, but mean something different).
There is also problem of local and world locations.

You need to calculate head bone LOCATION relative to root of character. For that substract player location from world location of camera, or just get LOCAL location of head bone. Do not mix local and world location without translating one to another.

And because it is so easy to mix vector with local and world location, always debug that and draw them with linetrace.

Sadly cannot answer more without seeing your setup for vector math.

You can do this easily by multiplying the vector by -1

Just want to say thanks guys. I am going to have another crack at it :wink:

Bookmark this: