and implemented an it on my character and it works great.
I also need to implement an aim offset for my weapon. (Its not really a weapon, its a fishing rod). It needs to rotate in the players hand.
The fishing rod is currently a child actor in the player blue print attached to the character mesh.
I have made the animations and the aim offset for the rod, added it into the rods animation blueprint.
In Ryan’s video, he shows in the event graph of the animation blueprint how you can use the pawn owner to determine what the yaw and pitch should be for the aim offset. As in this code below
I am struggling to do the same for the fishing rod as I cant use the TryGetPawnOwner blueprint as we are at a different level. (it being a child actor of the player rather than the player)
My question is how can I do the same thing (calculate the pitch and yaw) from the fishing rods bp.
Edit!
The following works, but is horrible, is there a better way of doing this?
It’s probably best to not use an aim offset on the fishing rod itself. Instead, attach it to a socket on the hand, and let the character’s aim offset handle the postition and rotation.
To control the bending for casting/reeling anims and such, you could use get owner in the rod actor’s graph and cast that to the character class. If valid you can grab any vars from the char needed to animate the rod.
Might be better to just add bones for the rod to the character skeleton, then add the rod as a skeletal mesh component, and animate it all in one place, using master pose to sync the anims like with any sort of modular character. Obviously this is more work up front, but it’s less for the engine to do at runtime, and should provide better results.
Thanks for the suggestions, my first choice was to try and rotate the rod based upon the characters aim offset by creating animations that also rotated the socket the rod is attached to, but it seems you cannot key frame the rotation of a socket in the aim offset animation. The rod in the hand moves correctly according to the characters aim offset, but i also needed to rotate the orientation of the line guides as the camera moved. I guess I could rotate the hand, but this might end up with some strange poses.
The bending I have done through a blend space of animations controlled by a force, and that is independent of the aim offset above. It seems to work well.
I quite like the idea of extending the character skeleton to include the rod, the only issue with this is that I want to introduce multiple rods, with different lengths which I believe would mean I would need to change the skeletal mesh, as a longer rod would need more bones. I don’t think this is possible at run time is it?
The above now works, but the code is flipping awful and the rod is now tightly coupled to the character in the animation blueprint which goes against all my programming principles
I’ve attached the “working” demo video, some of the offsets are incorrect which means its not as good as it should be yet, but I guess its a start.
I don’t think there’s really a way to add bones into a chain at runtime. To handle rods of different lengths, you could take a hybrid approach, and just have a bone for the handle of rods on the char to animate, and attach the socket to that for the child actor. That would also get around the problem of not being able to animate sockets directly.
Lots of games use generic weapoon bones like that for attaching swords and such so they can be spun around.