0 votes

So I want to make a AI aiming system and a gun system. I know how to record the player position. But the AI has guns so I want them to look at the player position to aim and shoot at them as well as follow them, how do I do that? I also want to make a gun shooting system how do I do that? Any good resources to help?

in Engine by (64 points)
edited by

1 Answer

+1 vote
Best answer

But the AI has guns so I want them to look at the player position

If you know the player position in global coordinates (and you say you do!), then you can use the look_at-function for that. Check out the documentation.

I also want to make a gun shooting system how do I do that?

There are a couple of plugins for that like this and this. If you want to implement a hit-scan weapon (i.e. a weapon that doesn't actually fire a projectile) I'd recommend this.

shoot at them as well as follow them, how do I do that?

Take a look at this tutorial on homing missiles. You might find his series on implementing a tank battle game helpful as well, especially parts 3, 4 and 5.

by (10,421 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.