Gun wont follow camera

https://playcanvas.com/project/1273597/overview/final

Gun won’t follow first-person camera :(. Not sure why, pretty sure gun is child of camera and camera is child of player, code looks right, don’t know what I’m missing.

1 Like

The code absolutely does not look right to me.

image

The code is unparsed and has absolutely no attributes, meaning that all values are running entirely on default values, and the script is generating its own camera instead of using the camera entity in your scene.

1 Like

This is caused by two firstPersonMovement scripts in your project. One in the Utilities folder and one in the Scripts folder. If your remove one and add the other to your Player entity, the problem is solved.

2 Likes

I didnt even notice that myself. Also, why is the camera in the first person movement example not clamped? Tell someone in your staff to go into the project and slap “this.eulers.y = pc.math.clamp(this.eulers.y, -89, 89);” into the very last line of update, and you will help so many new people.

Albertos is not part of the PlayCanvas team. They are just a volunteer moderator on here and the Discord server

Well someone needs to ram that thing in there, idk why it wasnt there in the first place. Or is there a reason as to why it isnt?

That worked :slight_smile: Thanks.