In my game I have a shooting weapon that is carried by enemy character. The enemy is animated and the weapon is attached to the socket on the skeleton. The weapon must shoot in a “natural” way - to there where the weapon points. But now whatever I did with the character mesh, the weapon shoots in the same wrong direction, completely ignoring the rotation of everything inside the enemy blueprint (only depending on the rotation of the enemy itself). Here is the “Shot” function in the weapon blueprint. What can be the problem?
Is ‘static mesh’ the gun?
Yes. (Strictly, not the gun but the bow. But it is not important.)
Is the X axis of the pivot point of the gun pointing down the barrel?
What do you call “the barrel”?
If so, yes.
Sorry, not X but Y axis. It is the entire problem?
Then yes, probably
X gives the forward direction in the engine, so is your projectile going sideways?
In the UE4, I used to place actor and then press “Merge Actors” having only one actor selected, to recreate the source mesh with the different transform. How to do the same in UE5?
The button you highlighted is disabled in my interface. How to activate the modeling of the certain actor?
Just checking it’s a static mesh?
No, it’s a skeletal mesh.
Ah… then the solution is to put a socket in the right orientation on the skeletal mesh ( there may already be one? ). Set your projectile orientation to that.
See the standard FP weapon
Now, I have rotated the bow mesh in Blender, re-imported it, set as main mesh in the bow blueprint, and it is oriented so that the +X axis is forward. But maybe the reason is that the enemy shoots at wrong time. To determine the end of aiming and the moment of shot, it uses the time of the aggression start, and tries to guess the time when the animaition passes the certain frame. But maybe it is possible to bind some action to the certain animation frame directly? I mean ON THE SERVER. (Because I remember I had seen some similar node a long time ago, but it had been marked as “for the cosmetic, non-gameplay actions”.) And I did set “Always Tick Pose and Refresh Bones” on the enemy mesh.
I have no idea about this.
I would recommend just doing a line trace to make sure your math is good, then go back to the problems of delay and multiplayer
Solved in this topic. In any case thanks for your support, I have learned much new knowledge! I hope you will help those who need it still for a long time. Good luck!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.