Make weapon move with player?

Ok so I’m helping make this battle royale multiplayer game,but I need advice on how to make the player move with the gun I tried using scripts from my old games(didn’t work).
I tried coding it in really didn’t wok well so if anyone has any ideas comment below.

You can simply just make the weapon a child of the player. When the player moves, all of it’s children will move/rotate with it.

I don’t know if that will work

you can parent it with the hand bone something like this

this.rhand = this.model.findByName('name of hand bone');
this.sword.reparent(this.rhand);

Im guessing the name of the hand bone would be the weapon

atleast show screenshots on how to do it

nope isn’t the weapon, each bone of the model has a name in my model is Bip01 D Mano you have to find the name in your model, there is a thread in this forum on how to do it.

Yeah well here´s the editor https://playcanvas.com/editor/scene/798662 so you can see what I mean

I see, you don’t have a player model so you just have to add a script to the weapon that get position and rotation of player camera and set the weapon position and rotation

2 Likes

click on camera add entity do make you wepean the adjust whare it is then it will move