Great! And I've been pushing updates to the git repo. There's now the ability to switch weapons and 4 different weapons including: the gatling you see here, hitscan laser, hybrid hitscan projectile "laser shotgun", and laser-guided missiles!
Thanks so much, this really helped me :) The case in which the bullet is slower than the target can be optimized a bit, though. Because `time` in that case is just 0, you end up multiplying the target velocity by 0, and then adding that to the target position. You can can simply return the target position instead, and you can even do the check before calculating a, b, and c. You can also check the squared bullet speed against the square length of the target velocity vector to skip the square root operation. You need the squared bullet speed later anyway, for calculating a. In my case I also added a check at the top of the method to simply return the target position when its velocity is approximately zero. Anyway, thanks again :) I first tried implementing a much longer function that I found on a gamedev website but I couldn't make that work. While I understand the principle I can't say I understand the math, but at least I have something working now :)
Insanely helpful. I was really unhappy with many turret tuts I'd found and this one was not just what I needed, but so thorough in the explanation. I'm still wrapping my head around some of how it functions, but I have it implemented nicely. My Corvettes now have ferocious CIWS stations to deter you from casually blasting in their bridges, Gundam-style.
You can use find to get the index of what you want to find and then turn around and use the indexes to get the corresponding values: a = [1 5 7 23 7 8 3 46 23 2 46 7 4 5] locations = find(a==23) values = a(locations)
All code is available on github: github.com/nealholt/TurretGodot Check out my other videos on target leading ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ZjMjxj_blMQ.html and compensating for bullet drop: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Hzgo5Jr2gI4.html
All code is available on github: github.com/nealholt/TargetLeadExample This follow-up vid explains the off center shots and adds compensation for bullet drop: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Hzgo5Jr2gI4.html
Complete code is available here: github.com/nealholt/TargetLeadExample Previous target-lead video is here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ZjMjxj_blMQ.html
Hey Neal, great video! What modifications to the mathematical formula would be needed to take into account bullet drop / gravity? Perhaps in the form of a float value, or a vec3
Great question. Off the top of my head, the speed x time right side of the equation probably needs replaced with the horizontal component of projectile motion V0 x time x cos angle. I’m not sure what else. Traveling right now but I’m excited to answer this question when I get back.
It was harder than I expected, but I did it! The most up to date code is on github currently. Video here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Hzgo5Jr2gI4.html
Hey man, really great video, I am a noobie on coding and I have a question to ask, I am trying to implement a lock-on system to my character. Would I be able to use this code for that function? Or would there be a system that would fit my needs?
Start simple and see if the look_at function meets your needs, but if not, I can certainly see this tracking code for the turrets being applicable, depending on what precise behavior you're hoping for.
It makes sense that such a detailed turret tutorial comes from a House of the Dying Sun veteran :] More tutorials related to this kind of games would be appreciated
This is great! But it seems to work on the opposite basis of Godot's -z = forwards convention - all my turrets are pointed in the exact opposite direction! Any way to fix?
Yeah, sorry about that. I think I put all my turret "heads" on backwards when I first made them and then instead of doing the obvious fix of righting the head, I negated z in the code. Play around with negating or changing the model and you should eventually get it sorted out.
@@NealHoltschulte Sorted - thanks! For others - I negated both instances of global_basis.z, and both the variables final_y and final_x. This alongside reversing the head rotation clamp solved the inverted direction. Great tutorial :)
Part110_chap12_then_11.m hi, went through the code and made it about 95% compatible with octave if you're interested line 31 sym is the octave function instead of str2sym line 39 replace entire line with ezplot(S) (while fplot works it requires (x, y)'s in octave line 41 and 44 dysfunctional since octave couldn't get line_data struct line 54 dysfunctional, not yet implemented in octave line 71 ezplot(x, y) works line 90 ezmesh(z) works line 94 ezcontour(z) works line 98 ezsurf(z) works line 102 dysfunctional, didn't find any surf contour func line 109 ezcontour(z) works 113a need a new line with this (just a string summing of original z's): z1 = '(3*(1-x)^2 * exp(-(x^2) - (y+1)^2)) + (-10*(x/5 - x^3 - y^5)*exp(-x^2-y^2)) + (-(1/3)*exp(-(x+1)^2 - y^2))' 113 ezcontourf(z1) works %ezcontourf help says z1 must be a string 117 comment out 118 ezpolar('sin(x)') works ; another string required says help 126 ezsurf(x+y+z) works
@@NealHoltschulte My pleasure. Good learning exercise for me, so win win. BTW do you know if symbolic has a semilog/loglog plotting analog?? Haven't found one yet.
@@NealHoltschulte You're welcome, my little contribution to the advancement of civilization. Thanks for your videos btw, very nice and helpful and informative.
Short answer, no. I don't know. Things to try: Check if the progress window got moved behind other windows (switch windows with alt-tab). Sometimes that happens for reasons I don't understand. Make sure you've closed out of other programs before starting the install process. Make sure you have enough space on your harddrive for the install. Sorry I can't be of more help.
@@NealHoltschulte Well it's for sure useful to me! I'm making a security camera that's got an armature/rig and can track a player. So it's slightly different in that I am working on bones instead of nodes, but other than that, it's pretty much the same. I originally tried to use the "look_at" and "looking_at" functions and just multiplying the axis I don't want to modify by 0 to "lock" axises. Those functions have some very specific requirements around the axis orientations that seem to not work well with bones though (ex: +Z or -Z needs to be forward and there needs to be a fixed well known global pos up axis). In my experience with rigging (which is limited and I might be missing something), your bone axis orientation is dependent on the bone chain, so you can end up in scenarios where +Z and -Z being forward just doesn't work and there isn't a good well known global position up axis, which makes makes those "look_at"/"looking_at" functions very difficult to use and debug issues with. The lower level approach taken by this video, and the easy to read code is exactly what I've been looking for. After this security camera, I plan to try and get this same thing working on a human's head/neck bone chains to try and get some character face tracking too, so yea I think this video helped me a boatload! Thanks again!
@@brennennen1761 I've not worked with bones before, but I'm happy this was helpful. I had a similar frustration with other tutorials telling me what to do, but not why and I was immediately stuck when I tried to do something slightly outside the box, so I wanted to make something that wasn't so rigid once I figured out how the hell to do it.
Awesome tutorial! I love to learn how to use math in games, especially 3d. I learned a little about vectors and dot product and now I'm using it everywhere in my code lol
what if there is no, my sql acc ? just java derby ? i couldnt create a database , please create a database in apache netbeans (this probably the best tutorial this year but this lacks the apache thing) !
This video was really awesome to me to understand basics of trigonometry on pygame! Now i wached more things and understood faster than before thank to the knowledge you gave me! You really well explained the rounding values of the rectangle, thank you! Really!
Bro how don't u have like 1 mil subs you genuinely teach this better than any other page and I'm coming back for more it's so easy to understand the way u teach
Not worth watching it all through. Lots of it is repeated. Still hilarious but not what I expected. Around 6:30 it started to repeat what was already shown.