I’m looking for something that’s almost the same as in that tutorial, yet I’m doing it with keyboard controls only and a FPS view.
After completing the first part (the hull) my eyebrows raised when seeing the results.
My tank is moving sideways to the left when i’m pressing forward. I just can not see how this is happening. I followed the steps, yet the result is completely different.
Can someone please explain to me why this is happening? And hopefully tell me how to fix it.
I’m completely new to UE(4) and could use a little help :).
My tank is oriented the ‘correct’ way in the character blueprint, the front side is looking the same way as the arrow.
I thought of rotating the tank in the character blueprint as well, but it does not feel like the proper fix to me. It feels like I am facing my mesh the wrong way just because my blueprint is false.
I can not make a screenshot of the input axis atm since I am at work, but I am pretty sure the problem is not in there(will place it here when I’m home).
I will give this a try, but it still feels as a workaround. I’m just wondering why my ‘tank’ (cube) is going sideways while i expect it to go forward.
If your fix works, I will be wondering why it is going forward because it should go sideways in my eyes
Edit: Adding a float of 90 does work like you told me. But the question still remains :). Or can you explain this to me?
Is the image above from before or after you add the suggested rotation?
The reason I asked about root node or mesh is that they might have totaly different rotations in the world. The mesh will have the roots rotation + it’s local rotation.
Specially since the movement is applied to the root. I still suggest that you get the rotation of the actuall root scene node and use that, instead of the rotation of the mesh.
Hello,
As the spaceman said, trouble is that you use your mesh as reference, not your actor. Your mesh is 90 z rotated compare to your actor, then when you use your mesh rotation, you base your move on this rotation, with 90 orientad. Use actor as source for rotation instead of mesh and it will be ok.
Ok thanks guys, I am actually moving forward now when pressing it :).
Is blueprint correct now for moving forward and backwards, or did I do something wrong with getting the root node? When I typed get world rotation i got 3 options (CapsuleComponent, Mesh and Camera). I thought that the capsulecomponent would be the root node, but then found the get root component option.
BUT… ‘forward’ does not change when I try to turn. The mesh does turn, but im not changing direction. I was thinking this is because it checks the forward of the root node now. So I tried to apply the root node to the Add Relative rotation, but that didn’t help :x. So I changed it back to Mesh now. This way the mesh rotates just fine, though I cannot turn.
Sorry for the (maybe) easy questions but I am really trying to understand what is happening and you guys are helping a lot!
I think I might have found your problem. Open up your blueprint, go to the defaults tab, and look for Use Controller Rotation Yaw. Set that to false/unchecked. If this is what it was, then let me know so I can try and explain why this was happening.
It was off already RO10.
But thanks guys. I just removed the character blueprint al together and started Fresh. Now, the mesh is correctly navigated towards the X axis. The blueprint from the tutorial does work now.
Will give our example a go as well to see if it works.
Ok couple of days later and a new problem appears :D.
I want to clamp the yaw of the turret to 180 degrees (and -180). So you will not be able to keep on turning your turret any further than 180 (or -180 degrees).
I got the following blueprint for my turret rotation (Which is working fine thanks to you helpfull ppl :P):
I noticed that the axis value coming out of the inputaxis is either 1 or -1 so that is not giving me the float value I need. I tried to get the relative rotation of the mesh and than clamp that value, but that made my turrent just spin really really fast.
One solution you can try out is using a Set Relative Rotation in place of Add Relative Rotation. Usually set relative rotation is used for setting something one way one , but of course it doesn’t always have to be used in that specific way.
To mimic add relative rotation, you need to do is add your desired rotation to the meshes current relative rotation. Then since we now have the current rotation plus your desired rotation to add, you can do with that result what you want (like clamping it) before feeding it into set relative rotation.
By the way just in case you didn’t know, you can right click a struct pin and split or recombine it, hence the split rotation values in the picture. Hope this helps!