Download

How to make aiming?

EDIT: SOLVED SEE ANSWER BELOW post number 8

I am working on a FPS shooter with full body rather than separate hands and body approach, however this might be irrelevant.

The question is how do I make animations for aiming your weapon down its sights? Do I need to make separate aiming animations for each weapon where you position the hands in such a way that when you look at it from the camera the aim is at center of the screen? or do I need to tweak it programmatically?

making animations for each weapon aiming is tedious as you have to correct the animation again and again to make sure the sights are properly aligned when you play it in the game.

I am sure there is some more intelligent way that I don’t know of , can somebody help me out?

Hi. Find Tesla Dev on youtube. Last 4 videos are from his livestream. There he is making a game from scratch. You can see how he is setting up aiming and other stuff there. I would suggest starting with the video thats 2hours long. Just skip the parts where he is setting up vehicle if you want.

If you use a special bone for your camera positioning then you can create a camera in your DCC package, attach it to this bone, set its FoV, then “look through” it and setup the character’s pose as you want. That way you can be sure that you will see the exact same image in game.

However if you don’t use a bone for camera positioning then it’s kinda wild guessing but still doable. You can create a fake “aim” object and set it like a hundred units away, aligning with your character’s center and aim constraint your gun to this object.

Yeah! that’s what I wanted to hear, this is indeed a intelligent and efficient way to do it . You have my sincere thanks

You are welcome :slight_smile: Share the results with us when you’re finished!

Indeed I will also share the blender export settings etc . but first I get need all these to a mature stage then put them together in a article form

Meanwhile this is how crysis does it , its funny and horrible at same time but it works

Ziss is the answer

Lol! I’m so stupid! All I had to do was to make approximate aiming animation and then in the game logic gently change the camera to a camera component in the gun actor.

Technically you make the gun as a Actor and then add a camera component in it such that its view is through the gun sights as you want to aim. Then all you have to do is when you want your character to aim just use setViewTargetWithBlend function to smoothly move the camera to the camera in the gun actor ! BAM you are now looking down the sights accurately without giving too much effort over aiming in animation.

Blueprints are a genius’s idea ! Way to go epic.

I just used math :slight_smile:
Check out me old TFPDemo.
Source is available with it.
Basically, its : target view location = sight location - (sight direction * ((direction from current view location to sight location normal | sight direction) * direction from current view location to sight location length)).

All this does is figure out a location parallel to the current view location that lines up with where ever the sight location is.
i.e. It’ll shift up and right, but not forward.

Up to you how to blend between the two, but I use FMath::VInterpTo().

Well that’s a more nerdy answer , and I’m lazy so I used the simplest solution, because when you visually place the camera component its much easier to place things at correct position than hard coding math and the best part is your game does not needs to know where the sights are.

shrug

I base the location of the sight on a socket, which is also hand placed.
Supports multiple sighting modes, blending, sights as attachments etc.
Much of a muchness really :slight_smile:

hey Kris, could you ever find time to teach me that?

@Kris, it appeared both of the links are out of date. Can you share the code snippets of your idea in codeshare.io or pastebin.com or something?

Does anyone know how to make the aim animation with bone controller like in the video?