Guns Not shooting straight

my guns no matter where i put my bullet path entity will not shoot straight, PlayCanvas 3D HTML5 Game Engine

Hi @Kevin_Herod!

I suggest to share a little more information in your post, to make it easier for users to help you.

I did a quick look at your project and found a line of code that doesn’t look correct to me.

result.entity.collision.entity.rigidbody.applyImpulse(this.camera.forward.scale(this.hitImpulse), result.normal);

Can you explain what you are trying to do here?

this was a previous attempt for camera effects, most of this Project was made with GPT, since i have no idea how to do shooting mechanics, i’ve noticed the guns shoot too low

I’m afraid it will be a lot of work to fix ChatGPT code. I think it’s better to use the manual or search on the forum for correct code.

i dont think the code is the problem, even with a very basic shooting code i just cant figure out why the guns won’t shoot straight, they shoot too far downwards and i have to aim like a foot above the enemies head to hit them

Can you show the code you use for shooting? Or can you tell which entities and scripts you use for shooting?

I don’t know how to pick up a gun and shoot in your project.

here’s the editor PlayCanvas | HTML5 Game Engine, its just E to pick up and left mouse to shoot, you can also go to the code itself if you please, i dont think the code is the problem im more tuned towards it being an attribute or entity problem

I start with an error and when I shoot I don’t see any bullets.

Your project is quite large, so I also need to know which entities and scripts to check.

image

it sometimes works but sometimes doesn’t, most of the time it works but i do randomly get errors that break the shooting, no idea why, and the bullet isn’t a physical entity but a raycast