# Trace from weapon is not straight while using fixed camera

**URL:** <https://forums.unrealengine.com/t/trace-from-weapon-is-not-straight-while-using-fixed-camera/456775>\
**Category:** World Creation\
**Tags:** forward-vector, Trace, control-rotation, unreal-engine, question\
**Created:** [October 10, 2019, 9:54pm UTC](https://forums.unrealengine.com/t/trace-from-weapon-is-not-straight-while-using-fixed-camera/456775 "2019-10-10T21:54:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bathorysthroat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bathorysthroat](https://forums.unrealengine.com/u/bathorysthroat)\
**Post date:** [October 10, 2019, 9:54pm UTC](https://forums.unrealengine.com/t/trace-from-weapon-is-not-straight-while-using-fixed-camera/456775/1 "2019-10-10T21:54:43Z")

</div>

Hi, I’m working on a game with a fixed camera system and I have a spear trace that starts at the barrel of a gun but ends at the floor??

This is how I set up the trace:

 ![289767-pistoltrace.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/1/8/41824d32e1d2de6260ba8c70849319dad33dbdf5.png)

This is the outcome of that trace:

 ![289769-pistoltraceresault.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/1/a/e1a46d5c27175c0e4338b381af0f29fafe6e8e20.png)

The trace does not remain straight and for some reason angles downward!

Now my camera system needs to “set control rotation” of the player when the player stops moving in order for the cameras to work correctly. I’m not sure if that has anything to do with the trace gradually pointing downward, it’s just a thought.

Does anyone have any idea how to keep the trace straight from start to end?

Thanks!

---

<div class="post-metadata">

**Author:** ![CrispClover](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/crispclover/32/1140157_2.png) [@CrispClover](https://forums.unrealengine.com/u/CrispClover)\
**Post date:** [October 10, 2019, 11:33pm UTC](https://forums.unrealengine.com/t/trace-from-weapon-is-not-straight-while-using-fixed-camera/456775/2 "2019-10-10T23:33:29Z")

</div>

Remove the z-value from the “end”-input, and plug in the z-value of the Pistol Trace Point Location instead.

EDIT: For anyone who does not know: You can split the vector input into the 3 floats (x,y,z) by right-clicking the pin and selecting “Split Struct Pin”

---

<div class="post-metadata">

**Author:** ![CrispClover](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/crispclover/32/1140157_2.png) [@CrispClover](https://forums.unrealengine.com/u/CrispClover)\
**Post date:** [October 10, 2019, 11:38pm UTC](https://forums.unrealengine.com/t/trace-from-weapon-is-not-straight-while-using-fixed-camera/456775/3 "2019-10-10T23:38:03Z")

</div>

You should be able to get the Actor Forward Vector without getting the rotation first.  
Also: I presume your Pistol Trace Point Forward Vector points towards the ground.

---

<div class="post-metadata">

**Author:** ![bathorysthroat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bathorysthroat](https://forums.unrealengine.com/u/bathorysthroat)\
**Post date:** [October 11, 2019, 12:17am UTC](https://forums.unrealengine.com/t/trace-from-weapon-is-not-straight-while-using-fixed-camera/456775/4 "2019-10-11T00:17:54Z")

</div>

Thanks, that got my trace to go straight. But when I aimed up or down it still pointed exactly straight. I fixed that by adding the Z’s of location and forward vector together, like this:

 ![289779-pistoltrace-fix.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/c/4/9c4f202ec1d1d03747be0dfa5342bdd95d68441f.png)
