Download

Tank Controls - Barrel with mouse, Base with keys?

Hey everyone,

I am new to Unreal Engine and have created a tank model. I have it in 2 separate static meshes TankBase and TankBarrel.

I created a blueprint first person project from the template and imported the model all went well.

What I am wondering is how I go about modifying the blueprint to allow the barrel and camera to rotate along the horizontal axis with the mouse X but have the tank heading independent using A and D to rotate the tanks base.

I tried opening the default character blueprint which is created and dragging the base and barrel into the blueprint and sized them up and set their location how its meant to be.
However when I go into the blueprint and set MouseX as the event I tried Set Actor Rotation, Set Relative Rotation but all I could find was using an actor as the target and I was unable to work out how to do rotation on the static mesh component from the component section of the blueprint.

any push in the right direction would be great.

-Kriogenic

Probably want this in blue prints section not content creation.

Yes in your character pawn blueprint is where you would setup both the tank_base and the tank_Barrel and the camera boom and camera in the components section.

Then you probably want to setup a simple blend with the tank treads moving and turning IE the tanks actual movement forget about the turret at first.

Now you got a tank moving the way you intended with the tracks and what it sounds like you want is the turret to be tied to the camera and swivel based on camera direction.

I would look up the 3rd person to first person zoomable blueprint tutorial. During that tutorial there is a event in the defualt settings that you can turn on and off something like “Get Yaw”. Your going to bind or attach this function to the turret I would imagine and not the tank tracks below it. Also I came across this in testing this will allow you to be moving forward with the tank in one direction while looking with the turret in another.

Really I would gander at the section of the tutorial I mentioned above should fill in your blanks.

Hey everyone I have managed to work a majority of this problem out. I now have the camera and the turret moving independently of the base and moving and turning the base works and so does spinning the turret however.

I have the camera in a 3rd person style view, when I rotate the turret I would like the camera to rotate from the turrets pivot point and not from its own. How do I go about doing this?

EDIT: All is good. I made the camera a child of the turret and now the camera follows the turrets pivot point exactly how I wanted it to behave.

Thanks OSIAS for the help.

Hi, any chance of a look at your blueprint, I’m trying to do a similar thing & thought I could plug the SM into the ‘Add Controller Yaw Input’ or ‘Add Actor Local Rotation’ but am getting SM is not compatible with Actor / SM is not compatible with Pawn