I used your logic in C++ and it solved my 1 week waste of time on a Tank turret :) Huge thanks, Subscribed instantly after my UE4 compiled and worked flawlessly. TNX
I have wanted to know how to do this for, no hyperbole, 3 years. I spent weeks on a project a few years back trying to work out how to do this manually before having to cheat and make one part turrets. Thanks for the simple explanation dude!
Amazing dude thank you, this is useful for an fps gun too, and thanks for implementing a screenshot of the finished stuff in your vid it's really helpful!
O.M.G Finally xD was trying to set a get target and use a spawn actor turret and attach it to a vehicle. this method works well for that , Plus ive transfer the variable of the relatives to an mesh with bones to then make replications ( for multiplayer ) thanks man :D EDIT : couldn't set the bones angles correctly so cameback to a 3part meshes turret and it's working ! :D
That was a good tutorial, however, my turret wasn't pointing at the player location completely, it was rotating but weirdly the mesh was rotated with 90 more degrees which made him look on the left of the player. I found a solution in case somebody come here and got the same problem (I guess that's the good solution) : So I added a vector-vector of -90 to make the turret look straight into player direction. This node was placed between the break rotator and make rotator node, on the Z (in the "aim target" custom event)
From the top of my head I'd say that when imported the model wasn't facing the correct way (down the X axis). Easiest fix outside of rotating the model and re-exporting is to change the 'import rotation' Z-axis inside the model's details window in UE4 and then reimport.
I've been struggling with a simple aim like this for a while. Got it semi working but the forward direction was always a little off from the target. IDK about this Inverse Transfrom From Direction node before so thanks!
You can make the turret aim at whatever you'd like. 😊 Could you provide a little more detail about what you'd like to do? Depending on the end goal, the process of implementing 'aim at mouse cursor' would be different.
Thanks a lot this works flawlessly. I had an issue with turrets for some reason getting stuck in an opposite direction but this was because I used the set relative rotation to a static mesh a hierarchy above the BaseMesh (I have 4 static meshes instead of 3). Now I can have turrets in my space game nice! Also I get a subtle flickering on the turrets when they try to rotate into their target whenever my ship is moving, anyway to fix that?
I run the level in Simulate mode, which allows the user to select and move objects while the game is running. Where you click the button to launch the game, there should be a drop-down menu to change it from 'Play in Editor' to 'Simulate'.
Hey! What would be the best solution for a World Rotation for the platform? I want to use a world rotation instead of the Relative to aim at the target.
is there a way to attach this to a third person character and make it fire at other third person characters? I'm trying to make a multiplayer game so they will have the same blueprint Edit: to put it simply, do you know how you can make turrets that point at the closest turret to it and fire a projectile at it without firing at itself?
That shouldn't be too difficult. I'd make a function that gets all turrets within a range (example: the firing range of the turrey) and save them in an array. Then I'd remove the turret from the array using a 'find' node to find itself, so that it can't try to target itself. Next would be a function to find the nearest other turret (which I can't remember how to do off the top of my head). If you require this in further detail I could do a side tutorial for it perhaps.
@@CrazyCatDev First, thank you for taking the time to reply to my question, Second, I'm honestly trying something by myself but since I'm pretty new to game development I think a tutorial with someone with great experience like you would be a great option for all the viewers and I think we can all benefit from it.
Couldn't you just get your actor location and your target location and use the function "Find Look At Rotation" and then set your relative rotation to that?
I did everything the same as in the video, only my turret is one piece, not 2 different pieces. I think I solved this problem by connecting my single piece to the nodes to which those pieces are connected. But my turret is not turning to the target, what could be the reason?
@mervenair4026 Unfortunately, without seeing how you've got everything hooked up, I wouldn't be able to suggest any solutions. If you have Discord, feel free to add me @ unlimitedcatworks, and I can try to help you from there. 😊 Did you try it with a multi-part turret and succeed before using your single-part turret? If not, perhaps that might be a place to start to make sure everything else is truly done correctly.
If you have discord feel free to add me and we can discuss your issue there: CrazyCatDev#2583. Otherwise, could you provide me with a link to a screenshot of what nodes are causing this error?
That is strange. Are you using your own meshes? If you are, perhaps you have exported them incorrectly? If you would like me to take a look personally I can be found on Discord @ CrazyCatDev#2583. 😊
You may have a node wired up the wrong way. I'd go through and make sure everything is wired up as I did in the video. Specifically the 'Find Look At Rotation' and similar nodes.
So I followed this. I'm not using a base for the turret, but that shouldn't matter as much as i've attached both the pitch and yaw to the same rotator. However, it's acting like a petulant child and looking slightly away from the target. Everything is exactly the same, except the target is not a basic sphere. Again, don't know how that would affect it as much, but you never know! Any assistance you could provide would be great!
Off the top of my head; if it is looking slightly off, remember that the turret will aim for the 0,0,0 of your target actor. If the actor is slightly off axis it will appear to be aiming off. Regarding the up and down, all I can say is to double check all of your blueprint to make sure it is correct. You can contact me on Discord if you like at CrazyCatDev#2583. 😊
@@LaFriteDuQC If you like you can 'zip-up' your project from the 'file' menu and upload it to Google Drive or something similar and I can take a look. Otherwise: Can you explain in further detail what part you're trying to do? What variable are you trying to use, and what are you trying to use it on (a 'for each loop', for instance)?
Thanks for the tutor. Please tell me how to aim the turret at my character? I selected my character's blueprint in the node "Get all actors of class", but it just doesn't work that way. P.S. Sry for my English. Google Translate
If you change the GetAllActorsOfClass to your character's blueprint, you will also need to update all variables and references to also reflect that. An example is you would need to change any variables that refer to the 'Target' blueprint to your character blueprint. I hope that makes sense!
@@CrazyCatDev got it to work, thank you. Using the "Get Character controller" function on the casting caused me a few problems though (well maybe i guess cause idont know how casting works) but ideally in the tutorial you would want to use a function you can apply to any actor. So you can also make the turret shoot at lets say a random rock. (or lets say path finding ai enemies in a tower defense game)
@@noji01x65 I understand what you are saying. In the way that the turrets look specifically for the 'target' blueprint I set up, you can use that 'target' blueprint as a Parent and make Children off of it (varying enemies for example) and you'd only ever have to look for the Parent blueprint and it'll at the same time check for any Children. I'll include a description of this in the next video. 👌
@@CrazyCatDev Hi, after some work i managed to get the turret to shoot at a specific actor as you explained, but is there also a way to make it shoot at the class of that actor? because i made a "target" spawn and follow each of the AI path following bots, but i cannot get the turret to shoot at the target within those bots. Thank you very much, good advice.
If you want to contact me via Google Hangouts, email (on my about page, hangouts also uses the same email) or a messaging program of your choice, I'd be happy to help you in real time. 😊
I used your logic in C++ and it solved my 1 week waste of time on a Tank turret :) Huge thanks, Subscribed instantly after my UE4 compiled and worked flawlessly. TNX
Happy to have been of help. 😁
Damn, thanks for this, you made this very simple and helped me understand some applications of ideas
I have wanted to know how to do this for, no hyperbole, 3 years. I spent weeks on a project a few years back trying to work out how to do this manually before having to cheat and make one part turrets. Thanks for the simple explanation dude!
Happy to be of assistance. 😁🤟
Amazing dude thank you, this is useful for an fps gun too, and thanks for implementing a screenshot of the finished stuff in your vid it's really helpful!
O.M.G Finally xD was trying to set a get target and use a spawn actor turret and attach it to a vehicle. this method works well for that , Plus ive transfer the variable of the relatives to an mesh with bones to then make replications ( for multiplayer ) thanks man :D EDIT : couldn't set the bones angles correctly so cameback to a 3part meshes turret and it's working ! :D
Thank you so much for this series! Super helpful and I learned multiple skills with your videos.
I am so happy you found my tutorials useful. 😁
Great, I will try to use it to create lamps! thank you!
One of the best tuts! I used FindLookatRotation before, but always had problems with its targeting :) Thx!
I'm glad that my tutorial could help you. 😁
What is the difference between using FindLookAtRotation and using InverseTransformDirection and Rotation from X?
To be honest I'm not 100% sure but I believe it has something to do with providing the correct calculations when the turret isn't on a flat surface.
Great stuff. It helped to solve the problem of a turret on my helicopter. Thank You!
Very damn helpful, I struggled a lot with angled turrets before.
Thanks for the tutorial.
I'm glad it helped you! 😁
You are my saviour, thank you man
Happy to be of assistance. 😊
Wonderful Job Man, thank you so much!
I am happy that you found it useful. 😁
This was really useful. I love you
Thank you for your kind words! I'm truly happy that you found it useful. 😸
That was a good tutorial, however, my turret wasn't pointing at the player location completely, it was rotating but weirdly the mesh was rotated with 90 more degrees which made him look on the left of the player.
I found a solution in case somebody come here and got the same problem (I guess that's the good solution) :
So I added a vector-vector of -90 to make the turret look straight into player direction. This node was placed between the break rotator and make rotator node, on the Z (in the "aim target" custom event)
From the top of my head I'd say that when imported the model wasn't facing the correct way (down the X axis). Easiest fix outside of rotating the model and re-exporting is to change the 'import rotation' Z-axis inside the model's details window in UE4 and then reimport.
I've been struggling with a simple aim like this for a while. Got it semi working but the forward direction was always a little off from the target. IDK about this Inverse Transfrom From Direction node before so thanks!
Excellent. Thank you.
Great video. Was exactly what I was looking for. I used this to create a tank turret aiming system like in WoT or WT
Hi. about to go into your videos. Looks very exciting. Quick question, how hard would it be to set the turrets to aim at the mouse cursor?
You can make the turret aim at whatever you'd like. 😊
Could you provide a little more detail about what you'd like to do? Depending on the end goal, the process of implementing 'aim at mouse cursor' would be different.
Thanks a lot this works flawlessly. I had an issue with turrets for some reason getting stuck in an opposite direction but this was because I used the set relative rotation to a static mesh a hierarchy above the BaseMesh (I have 4 static meshes instead of 3). Now I can have turrets in my space game nice!
Also I get a subtle flickering on the turrets when they try to rotate into their target whenever my ship is moving, anyway to fix that?
Awesome tutorial!!!
Plz continue, you do well :)
Thank you! Part 2 is already available and I'll be making Part 3 soon hopefully. 😊
Awesome! Thanx!
Thanks a lot! Very cool!!
Thank You!
Hello, Iam pretty new to unreal. Can you tell me how you move target while level is playing? Cannot find it out anywhere. Great tutorial :)
I run the level in Simulate mode, which allows the user to select and move objects while the game is running. Where you click the button to launch the game, there should be a drop-down menu to change it from 'Play in Editor' to 'Simulate'.
@@CrazyCatDev Thank you very much. Like I said - Nice tutorial
Pretty cool. I wonder if its possible to make it with skeletal bones, not separated models
I'd wager that it'd be possible to use a skeletal structure.
Hey! What would be the best solution for a World Rotation for the platform? I want to use a world rotation instead of the Relative to aim at the target.
Could you explain what you would be trying to achieve with that? With a better idea of that, I should be able to assist you. 😊
is there a way to attach this to a third person character and make it fire at other third person characters? I'm trying to make a multiplayer game so they will have the same blueprint
Edit: to put it simply, do you know how you can make turrets that point at the closest turret to it and fire a projectile at it without firing at itself?
That shouldn't be too difficult. I'd make a function that gets all turrets within a range (example: the firing range of the turrey) and save them in an array. Then I'd remove the turret from the array using a 'find' node to find itself, so that it can't try to target itself. Next would be a function to find the nearest other turret (which I can't remember how to do off the top of my head).
If you require this in further detail I could do a side tutorial for it perhaps.
@@CrazyCatDev First, thank you for taking the time to reply to my question,
Second, I'm honestly trying something by myself but since I'm pretty new to game development I think a tutorial with someone with great experience like you would be a great option for all the viewers and I think we can all benefit from it.
Wow! It works perfectly...! How can I shoot a projectile to the target?
Finally got around to it. :)
Part 3: ruclips.net/video/Yky0ON3wPS8/видео.html
Couldn't you just get your actor location and your target location and use the function "Find Look At Rotation" and then set your relative rotation to that?
That works on a very basic level, but has issues when the actor isn't on a flat plane.
I did everything the same as in the video, only my turret is one piece, not 2 different pieces. I think I solved this problem by connecting my single piece to the nodes to which those pieces are connected. But my turret is not turning to the target, what could be the reason?
@mervenair4026 Unfortunately, without seeing how you've got everything hooked up, I wouldn't be able to suggest any solutions. If you have Discord, feel free to add me @ unlimitedcatworks, and I can try to help you from there. 😊
Did you try it with a multi-part turret and succeed before using your single-part turret? If not, perhaps that might be a place to start to make sure everything else is truly done correctly.
@@CrazyCatDev thanksfor your attention . I will contact you on discord later.
Whats the error "rotator is not compatible with static mesh component object reference
If you have discord feel free to add me and we can discuss your issue there: CrazyCatDev#2583. Otherwise, could you provide me with a link to a screenshot of what nodes are causing this error?
hi
continue tutorial for ue4
thx
I do intend on it, just need to get the time to do it. 🤟
Неплохой метод. Спасибо.
Happy to help!
Great tutorial! For some reason, my Turret just seems to be aiming from the wrong end of the canon. Is there a way to fix that?
That is strange. Are you using your own meshes? If you are, perhaps you have exported them incorrectly? If you would like me to take a look personally I can be found on Discord @ CrazyCatDev#2583. 😊
@@CrazyCatDev yeah I was using my own mesh and thanks ill hit u up there!
I'm having the same issue. Did you find a fix?
My canon is facing the opposite direction, any advice?
You may have a node wired up the wrong way. I'd go through and make sure everything is wired up as I did in the video. Specifically the 'Find Look At Rotation' and similar nodes.
So I followed this. I'm not using a base for the turret, but that shouldn't matter as much as i've attached both the pitch and yaw to the same rotator. However, it's acting like a petulant child and looking slightly away from the target. Everything is exactly the same, except the target is not a basic sphere. Again, don't know how that would affect it as much, but you never know!
Any assistance you could provide would be great!
Also, doesn't want to look up and down either.
Off the top of my head; if it is looking slightly off, remember that the turret will aim for the 0,0,0 of your target actor. If the actor is slightly off axis it will appear to be aiming off.
Regarding the up and down, all I can say is to double check all of your blueprint to make sure it is correct.
You can contact me on Discord if you like at CrazyCatDev#2583. 😊
I can not connect the variable to the get sa puts me "object reference is not compatible" you can help me
my version is 4.24.3
That error means you have either the variable set to the wrong type, or the target set to the wrong type.
@@CrazyCatDev
and how we solve this problem ?
@@LaFriteDuQC If you like you can 'zip-up' your project from the 'file' menu and upload it to Google Drive or something similar and I can take a look.
Otherwise: Can you explain in further detail what part you're trying to do? What variable are you trying to use, and what are you trying to use it on (a 'for each loop', for instance)?
@@CrazyCatDev
i'm sending you on ccdevgames@gmail.com
@@LaFriteDuQC I have emailed you a response that hopefully will fix your issue. :)
Thanks for the tutor. Please tell me how to aim the turret at my character? I selected my character's blueprint in the node "Get all actors of class", but it just doesn't work that way.
P.S. Sry for my English. Google Translate
If you change the GetAllActorsOfClass to your character's blueprint, you will also need to update all variables and references to also reflect that. An example is you would need to change any variables that refer to the 'Target' blueprint to your character blueprint. I hope that makes sense!
@@CrazyCatDev I did something like this a little earlier, but thanks anyway for the answer.
@@kostyayaskevich6920 If you have any difficulties you can always message me on Discord and I can assist you directly. 😊
hm, for me it just aims at the object on the first tick and then it stops, i copied what you did in the video, what might it be?
Without more information I can't accurately help you. You could zip-up your project, upload it to Dropbox or similar and email me a link?
@@CrazyCatDev got it to work, thank you. Using the "Get Character controller" function on the casting caused me a few problems though (well maybe i guess cause idont know how casting works) but ideally in the tutorial you would want to use a function you can apply to any actor. So you can also make the turret shoot at lets say a random rock. (or lets say path finding ai enemies in a tower defense game)
@@noji01x65 I understand what you are saying. In the way that the turrets look specifically for the 'target' blueprint I set up, you can use that 'target' blueprint as a Parent and make Children off of it (varying enemies for example) and you'd only ever have to look for the Parent blueprint and it'll at the same time check for any Children. I'll include a description of this in the next video. 👌
@@CrazyCatDev Hi, after some work i managed to get the turret to shoot at a specific actor as you explained, but is there also a way to make it shoot at the class of that actor? because i made a "target" spawn and follow each of the AI path following bots, but i cannot get the turret to shoot at the target within those bots. Thank you very much, good advice.
If you want to contact me via Google Hangouts, email (on my about page, hangouts also uses the same email) or a messaging program of your choice, I'd be happy to help you in real time. 😊