Barrel rotation may be of

Hi so I’m trying to correct my aim and I’ve finally after a week of struggle managed to get the bullet to hit it’s target. But I have another problem. And thats the rotation of my barrel. the barrel rotation is way of in comparision to the bullet line.


The black line is the current bullet path (ich) and as you see it doesn’t start of nice from the barrel but it hits its target :smiley:

anyway I would prefer the blue line but since this is at a close range it’s not optimal to go for the high arc aim solution.
The best solution would be the red line but I don’t know why its aim is so of. I am using the low arc for my game and I’m not tracing in suggestprojectilevelocity.

Hi,

In which course are you? And for which course project is this?

It looks like unreal battle tanks

In this case, I’m moving your thread to the correct subforum. This one is for the Unity courses. :wink:

You mean it’s not at the barrel? Would need to see your code.

  1. Sorry I’ve have had some problems posting on this forum the last week don’t know why :frowning:

Here you go, I have to mention tho that I’ve actually managed to get the right aiming direction aswell as bullet path for my projectile. But I stil have problems with my aim. The barrel either goes to high or to low in relation to it’s target. when aiming on the tank AI the aiming solution works fine, but when aiming at the landscape its another story.

I needed to rotate the projectile socket with the same elevation change as the barrel to get it to work. But as I said the aim is still of and I’m debugging at the moment, any tips may be helpful.

Is using .Roll in Elevate intentional?

Yes it’s intentional since the Roll axis is up/down atleast in blueprint. In c++ I can get the elvation rotation from pitch but I need to pass it to the mesh as the Roll axis. Don’t know why but in a whole yes It’s intentional. I have managed to get the bullet to fly as intentional but it’s stil a aim problem regarding both the rotation of the barrel. Where the elevation is either to high or low.

It would be easier for me to diagnose this if I could debug your project. Do you have it hosted anywhere like GitHub or Google Drive?

Right! I totally forgot that I’ve could share my Github repo! It’s for the latest commit I’ve made so its up to dateGithub Repo:

Just remembered Ignore the Frotator Parameter TankRotation passing into AimAt (it were a try to correct the elevation angle when it worked even worse. But It’s not used so just ignore it for now). :slight_smile:

You seem to be missing a lot of files. The tank has no meshes, there’s no game mode or input configs, etc.

Whoops it appears I’ve gotten an extra ignore file anyway heres an new Push

Hoppfully everyfile needed is included :smiley:

Ok so I don’t have more time to continue debugging this today but in the meantime you could fix your orientation issues.

Unreal has positive X being the forward direction and your meshes aren’t facing that way, you can reimport them so they are facing the correct way, just change the import rotation settings and then use reimport, example gif:

https://gyazo.com/c0725ca4f9cdbc7bd3be9c3a8fb62d1e

Thank you so much @DanM by following your instructions, changing the elevation limitation values and some statement I got it to work as intended. And here’s my Github repo if someone may have the same problem/ made the same mistakes.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.