How to render a crosshair for Third Person Shooter?

Hello,

I know there are some info in the Internet, but I can’t still figure out how to make a simple crosshair for TPS attached to the traced line.

Random thought!

add a bone to your character say 10-20 feet in front of them? then in engine setup a simple laser like effect to go from the character to the bone? (idk if this is possible, just throwing an idea out there for you)

works!

i created a root -> then a Xhair bone in the middle front of the char (perhaps tip of hand or gun?) then a sub bone far out even and straight from object (so projectiles will go to the xhair)

you can attach objects. effects. sprite, mesh, pretty much anything to the socket that fits your needs.

Thank you for your thought! Sorry, I don’t know if I understand.
I have a character with a gun and a trace line (raycast) is going. All works, but I would like to add a crosshair to have a better aiming (just like in First Person Shooter). How can I add a bone to my character with a standard skeleton? In UE4?

You can create a UMG asset to do this.

Here’s a link to one I use for my game: https://www.dropbox.com/s/iqdmas8c1lpbsry/Crosshairs.uasset?dl=0

  1. Download that uasset.
  2. Close your editor.
  3. Move the .uasset into your project’s content folder.
  4. Reopen your project.
  5. In your player controller add a CreateWidget node to your EventBeingPlay and select Crosshairs then add a AddToViewPort node and connect the widget to that. Tada!

Thank you very much, MiDri! I did as you told.

a7cccef7a8e9a9626553d701590dcb3bbcc909b1.jpeg

However, I don’t see the crosshair. Have I forgotten something?

bd85a62221b41251f6079830923836140c2b75ae.jpeg

Humm, maybe try setting the zorder to something really high like 100 in the extra settings drop down on Add to Viewport… Also make sure your gamemode is set to use that character controller.

I should also note; that particular crosshair might render into the back of his head due to your camera placement. Generally with 3rd person shooters you want the camera to be slightly to the left (or right if left handed) of the player and up.

I have tried ZOrder for 100, 0 and -100. GameMode is set to use a proper CharacterController.

I used the the Animation Starter Pack, only changed the mesh for characters. So how should the camera be placed in TPS?

Hey Tomza for my example i added the bone in Maya, just one in the upper middle, then one straight forward from that. and in UE4 skel editor i added a socket to the front bone. then ingame you can show/hide / attach anything to the socket, in my example i attached the fire effect.

in the picture you set the crosshair widget to be created by “self” is that the right option? i would have though you would use “Get player pawn” so you can get player 0’s pawn. that way if you “respawn” or destroy / spawn the actor it will go to the correct object. but i might be mistaken.

I just tried this one, the crosshair is litterly a cross in the middle of the screen. that is not effective for a third person game what soever.

and it was get player controller as the create widget plugin.

I will post again in a minute with a couple pictures to show you how to do it in UE with a char model. its pretty simple.

Thank you very much for your precious help. Sorry, I have not Maya. I use Makehuman and its Game skeleton, then I import the character to UE4. Should I use any 3D modelling software to change the skeleton? I mean the adding the additionally bone.

EDIT: I used Get Player Controller instead of self and all seems the same - no Crosshair.

The problem with crosshair in TPS is common in the Internet because many people ask for it. If we find a very good solution, it will be useful for other users.

I made an example where all you need is a model with a bone in the middle of the chest (Assuming w/e player you are using has some kind of skeleton)

So what i did first was open the skeleton in UE4, then on the skeleton tree i found a bone that was in the middle of the chest.
right clicked and hit add socket, then i named the socket “Crosshair_Socket”.

Next i went to the character blueprint. on my event begin play i did this:
basically attach a “Sphere” that i added to the blueprint via “add component”.

(In this picture you notice it says socket “none” i took the picture before i realized and replaced “None” with “Crosshair_Socket”)

after i attached it, it was inside the character, so in the view port editor, i used the move tool to drag it 1000 units from
the character model.

and now i have a “Sphere” (insert litterly anything here. texture? material on sphere? ect ect, effect? anything).

now you have a object in the world that you can reference and or use as your crosshair, that will always be dead center of the character, you can add a laser particle effect to go from the character to the object to get a “line” in space. or just texture the sphere to have a X in it and a glow? you decide!

Wow, THANK YOU VERY MUCH! I didn’t expect such info. I will try to play with that tomorrow. I will write if I successful or not because it’s an interesting topic.

Duwayne, I have tried your way. It’s a good idea and it’s even working sometimes, but alas it seems not good solution for my third person character. It’s a specific one - MiDri was right. It’s a problem with the character camera (I have two cameras for switching to make the player FPS and TPS). However, I changed the start of traced line and now the fire is much more precise. It seems this solution works without a crosshair. Really, it works excellently now. Maybe, your solution will be useful for other users that use a typical TPS. Thank you, guys!

I’m glad you found a working solution for your game!

I didn’t realize you needed First person as well as third person.

Sorry, I didn’t tell you because it seemed not important. I wished to have a crosshair for TPS only because it would be the same for my FPS. I just placed an additional (FPS) camera in the character head, so I can switch from TPS to FPS and from FPS to TPS. It’s a trick. And it is not a problem because a working crosshair would be great for both FPS and TPS. The problem is that my character is specific and typical settings don’t probably work. I couldn’t find a solution, so I started the thread to know other opinions. Your solution works, but not for my character or works partly. The fire is accurate only in a short distance. Thank you very much. Thanks to you I realized the good crosshair for my character couldn’t be made. It’s probably impossible. However, I can shoot precisely and it looks and works great.

Anyway, the tread will be useful for others because many people have problems with their TPS crosshairs.