Applying force to socket?

I am making some weapons in Blueprint and I want to add recoil. I’m no animator, so I’m thinking maybe I could apply a force to the muzzle socket and make my blue guy react to that

But it’s not working. Is it possible at all? Do I need to change anything on my character to make it happen? I hope you guys can help. Thank you
:slight_smile:

I’m not an expert when it comes to animating, but you should probably use animations for this. I know you said you’re not an animator, but “generating” the animation at runtime will probably be very complicated and/or look horrible. There may be a way of rotating the weapon and using inverse kinematics to have your character react accordingly, but you would be better of learning the basics of animation.

Well…

If it could be as simple as applying a force it would be much more versatile. A small gun would have little recoil, bigger guns more. Some have high lift on the barrel, others just a big kick backwards but little lift.

As for generating it at runtime, I’m guessing it is less complicated than rag doll physics.

You can blend animations and physical simulation, but you’ll need a physics asset for this (ragdoll). Take a look at the physical animation level in the content example project.

However, I think the force approach will only work for a small amount of recoil where the arms do not move too much and you can set the blend amount to be quite low. The problem here is that if you simulate the arms they will naturally want to fall. To prevent this you’ll need to use motors (which you can setup inside PhAT).

I think you’ll get the best results by using inverse kinematics with the position of the gun moving like a spring.

Hope that helps

I have to admit that I don’t really know if this can work, just an idea, is it possible to create one recoil animation that would represent the maximum recoil from the biggest gun in game then blend it at runtime with blend weight depending on the severity of recoil we need at the moment, to produce an amount of recoil needed? Character hands would be animated this way and the weapon would be attached to them and just follow.

I went to the IRC channel and talked to a couple of people there. For now I will be testing with IK, it seems that is the simplest way to get the result I want.
As for using one animation, I decided against that for 2 reasons.

  1. I don’t have that animation, and no clue how to make it.
  2. It is not as easy to add random sideways movement to that.(Tiny amounts, but still)