Hi guys got a problem with Set World Rotation, need some help for the solution.
As you can see in the video I’ve made some top down shooter using WASD to move the Vehicle while at the same time the Turret on its top will face mouse pointer.
To make things a bit dramatic I’v build a blueprint to roll the Vehicle a bit left or Right as it turns. All looks just fine until the vehicle turns… When the Vehicle start rolling to Left or right, The turret does not
follow it parent (in this case the vehicle). It just maintain its own roll axis. I want it to stay and roll with the parent while also keep facing to mouse pointer as much as possible at the same time.
I’ think this happens because I use SetWorldRotation to make turret face mouse pointer. Like the BP attachment, I use FindLookAtRotation and only use Yaw axis to rotate the turret. The thing is, as I set the Yaw axis from FindLookAtRotation output, there is no input for Roll and Pitch Axis, there for SetWorldRotation set it both to 0, instead keeping its own current rotation it set its roll axis to 0.0 . So how do I make SetWorldRotation Roll axis to Null or something so it will maintain it own current roll axis?
Unless I’m misunderstanding, couldn’t you just ‘getRotation’ of the turret and then plug the X and Y output nodes into the inputs on ‘setWorldRotation’?
I will try to set roll to hovercraft…If I found out how that is :D… sorry I’m still new with this thing.
SetRelativeRotation doesn’t work, I have try it… the turret indeed follow the Hovercraft roll but when the hovercraft is turning (change direction) The turret no longer use it own X axis as Forward, the turret forward change along with the direction of Hovercraft or maybe FindLookAtRotation is using parent or root Forward direction instead the Turret local Axis, I’m not really sure…
Drag Hovercraft from the left panel into the blueprint graph to get a reference.
From there, drag the pin and type “Get World Rotation”
Then right click on the Purple Pin and click on “Split Struct”
Drag the Roll and connect it to the Turret roll
Sadly… is not working also -___- its working at certain direction, but when the hovercraft moving to the opposite direction the turret still roll to the original direction.
I have this idea how to work around this problem but I don’t know the function node to do this in Blueprint (or even if its possible or not)
What I need to do is make and Empty Object (or non-renderable object) at the top of the Turret then link it to Hovercraft as child for hovercraft. So it follow the Hovercraft every transform. (like what the turret suppose to do -___-) After that I use another LookAtRotation using Turret’s Up axis to find the Empty Object while simultaneously using its Forward axis to find mouse cursor.
I’ve ask this method to my friend (a unity programmer). He said is possible using Quaternion…something in unity. (he explain this to me in programmer way which then I’ve failed to follow after three words came out from his mouth )
So… is it possible to do this in BP? because I don’t even know how to use 2 axis at the same time or even use Roll axis for FindLookRotation input.
this is Bp to rotate DefaultPawn to face WASD input direction or Left Thumbstick. I’m using DefaultPawn so Floating pawn movement build in already provide me with movement direction.
This BP is to set Var integer as the DefaultPown rotate to input direction, -1 for left turn, 0 for straight, 1 for right turn, then the variable is sent to Hovercraft rolling part of BP
After you told me to get hovercraft rotation for turret roll.
I get the feeling that BP I build to Roll hovercraft while turning is so…conventional or primitive because these are the Function node I know how to use right now.
If you have a suggestion to build BP more effectively I would be grateful.
And sorry for the late feedback, kinda busy this weekend helping my cousin getting married.
Sorry, been busy myself lately. But just looking at your Blueprints, you are moving the hovercraft using relative rotation but the turret using world rotation. Use relative rotation for the turret as well. I think that may fix your issue.