So I’m making a game that has a mechanic where the player can place an object on the ground. I want to implement the mechanic so that the location that the object is placed is based on where the camera is looking (I have a free third person camera). Everything works fine except for if my character is moving, specifically in a direction that it is not already facing. If the pawn rotates even a little bit, the location that the trace spits out jumps to the side drastically then jumps back. I believe this is due to the camera and spring arm actually rotating with the pawn but I can’t for the life of me figure out how to get around it. The script that I’m using to do the trace is below, and a video of the bug is in this google drive link (it was too big to share on this post).
This behaviour does seem incorrect. The way you currently have it setup seems correct. This could have something to do with the lag of the boom, and its giving you an incorrect actual position of the camera. You could try changing your actors tick group as the timing of your location access might be affected. I wouldn’t suggest that though, just something you could look into.
For a workaround to this, you can try getting the camera location differently. This solution I believe has a 1 tick delay, but should work much better.
Get the screen resolution, cut in half to get center, then de-project that into the world space.
Use the resulting World Location and Direction for your trace calculations. The return value should probably always be true, but its smart to branch anyway.
Thanks! That works! I’m really confused as to why my way doesnt work though… I even tried the same setup on Shinbi (one of epics paragon characters) and the result was the same… I guess its a weird consequence of the spring arm…