Need help with guns

can some one please give me code to make my gun be positioned like the pistol in doom and make it shoot

Hi @Ronan_Ohara,

To position the pistol as in doom, you don’t code, just add it as a child to your camera and it will follow it.

To make it shoot you need code, study the raycasting tutorials here on how to start with that:

https://developer.playcanvas.com/en/tutorials/?tags=raycast

why do i need to buy a lcd tv

2 Likes

Sorry accidentally pasted a personal link for someone that needed to buy a new TV :innocent:

6 Likes

also when i made the gun a camera child my fps movement scricript broke without a debug message

@leonidas you havent sent anything you said study the raycating tutorials here and theres nothing.

Sorry guys, I think my message wasn’t edited correctly, I’ve edited it again.

thank you it shows now

honestly i have no idea what im looking at is this supposed to help with making a gun idk i thought the link would take me to a tutorial of how to make a gun fire or the code for shooting a gun, is there a code?

Hello @EhsaanAKhan!
Maybe this thread will help you:

ive read this before like 5 times and every time ive read it ive been more confused than the last time

im a beginner so none of this will help since i dont really get coding as much as others

How is your game set up looks like right now?

im sorry i dont understand

I mean what do you have so far?

honestly nothing

If you add me to your project I can try to set up the first things for your gun.

okay i’ll add you in a sec

I added three gun models to your project. You can find them in your Models folder.
I also added these to your level 1 scene. You can find them in Player > Weapon. You can enable the gun you like, but I can add another gun for you if you don’t like these guns. The Weapon entity must be rotating with the camera. I am not sure why this is not already happening as it is a child of the player…

could you add a glock because i feel like the 1911 and the other pistol doesn’t really suit the game im trying to make here, also thanks for your help