Lock the Mouse Position to the Center via Blueprints
I'm trying to make some FPS kind of camera, but I am unable to lock the mouse position to the center of the screen.
Is there any way of doing so? or would I have to set whatever I shoot to go directly to the center where the cross would be?
Thank you very much. :)
asked Oct 13 '14 at 06:30 PM in Blueprint Scripting
I guess most Shooters just make a Line Trace from the middle of the camera straight forward and if this trace hits something it will deal damage. You won't really shoot something. Only emit a particle like blood, ground, rock, etc depending on what you hit.
The trace itself is a Node "Single Line Trace ... " the "..." is either for channel or objects.
There you can set a Start and an End Point. The Startpoint would be the middle of the camera (where your Crosshair is) and the endpoint the forward vector of the camera multiplied with the range the weapon should have.
For the start you would get the Player Character Position, add the height of the Camera to the Z axis (the height is the Z value of the Position inside your Components tab of the player).
The end would be getting the Camera Manager (by node) and getting the Forward vector of it. Multiply this vector by a float with the range you want and add the start position (the one you pluged into the Start of the Line trace from above) to it. Than plug this result into the End of the Line Trace.
Choose the objects or channels you want to trace and work with the hitresult. You can break the hitresult and get serveral things like the actor you hit or something.
EDIT: Here is a picture from a setup i made for this. This is some way to do it.
Follow this question
Once you sign in you will be able to subscribe for any updates here