Download

Get Forward Vector not changing z coordinates

I am using the example first person shooter map.

When i click the mouse i am doing a linetrace and i’m printing the linetrace vector on screen.

I use get “forward vector”. But the z coordinate keeps being the same not matter how high i point up or down with my gun.

If you for example would shoot a cube that was floating in the air the z coordinate must change too.
How can i make this happen?

https://snipboard.io/blYnSJ.jpg (FirstpersonCharacter blueprint)
https://snipboard.io/ACx7wQ.jpg
(playing the game and printing the new vector)

“forward vector” of what? The camera? the gun? the character?

Show us the BP of that part.

GetForwardVector returns a direction vector, not a location vector. What you are describing with the floating cube is a location.

Basic vectors and their math does take a bit of getting used to, but you will learn to understand it quickly if you just keep at it.

First, set your Line Trace to be visible, to make sure it’s actually doing what you want it to. After that, if you want location of the trace hit, you want to break the hit result using either BreakHitResult node or right clicking the hit result pin and breaking it right on the node. One of the outputs will be hit location.

Sorry i uploaded 2 samen screenshots.

This is the blueprint of the FirstPersonCharacter

Example of a trace from the gun’s muzzle to wherever the crosshair is pointing at (close enough):

](filedata/fetch?id=1825254&d=1603463892)

Result:

2.jpg](filedata/fetch?id=1825255&d=1603463902)