How would i make a gun and when the player holds down rmb it shoots?
Hi @plok_cxz,
There isn’t any ready made tutorial to see this in action. As a short summary of the steps you need to build this:
- To have your player hold a gun:
- If you are doing a First Person Shooter, add the gun as a child to the camera.
- If you are doing a Third Person Controller, add the gun as child to one of the bones of the character’s model.
- To shoot you will have to study how to create projectiles: fast moving objects that travel from the player to the direction the gun is pointing to.
Trying searching the forum with keywords like gun, first person shooter etc.
also how would i limit looking up and down
You will have to add some constraints on your camera script, to check the up/down angle and stop rotation.
what would the rmb be labeled as?(like right left etc;)
https://developer.playcanvas.com/en/tutorials/mouse-input/
The developer documentation does have a decent search feature for this kind of stuff.
https://playcanvas.com/editor/scene/1360663
here is my game how can i make the gun rotate with the player?
Hi @SLAVRED0000N4SIR! You can make the gun entity a child of your player entity.
i have already done that. how would i be able to rotate it around a player.
What do you mean with ‘rotate it around the player’? Do you have an example?
https://launch.playcanvas.com/919035?debug=true
where the gun look’s into the direction the player is facing.
this is the issue here:PlayCanvas | HTML5 Game Engine
if you do not see the gun when you spawn. look around and you will find it.
Sorry, it has to be a child entity of your camera entity.
how can i do that?
Drag and drop your gun entity into your camera entity.