0 votes

I tried making a projectile weapon but it only shoots straight at certain angles. I've put a link of pictures to the related code of the player and bullet scenes along with its odd movement. If you have any suggestions or need more please let me know and thank you.
()
P.S. the blue mesh you can see coming out of the hand is a cylinder mesh that goes parrallel to the raycast from the head into the -z axis.

in Engine by (18 points)

Your picture is not appearing. You need to use a hosting service like https://imgur.com/ for example and then use the link provided.

If I understand correctly, your bullet shoots straight (which is what you want) only a certain angle? What is the behavior when it's not the case then?

Can't see the screenshot

I can see the screenshot by opening it in another tab, the link just goes to an album rather than one image.

here's a link to the album

Ok so the problem might me that you're instantiating the bullet in the same scene as a child as the hand. Thus when you move the hand, the bullet will move too. So you should probably instantiate the bullet higher in the node tree, probably in the parent of the player.

yea I had already a line of code for that
func ready():
set
as_toplevel(true)

Also even if I stay still the bullet travels at angle if I'm not perfectly on the z axis.

thanks :)
I didn't know how to do that

I ended up changing the way I translate the bullet. Rather than giving the rigid body an impulse, I gave it a velocity using a Vector3.

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.