- Home /
Attaching an object to a camera movement weird, Help!
So I made a gun model in Unity, and attached it to the camera, just by parenting the camera to the gun model. When i move the camera, the gun moves just fine with it. The only problem is that the way it moves is not correct. The gun does not stay in its place, it moves everywhere, and I've tried everything: scripting it on there, ravaging the internet for a solution, nothing works. Thanks!
Have you tried parenting the gun to the camera ins$$anonymous$$d of the camera to the gun?
If you don't want the gun to move, you have to apply the movement to the camera, not the gun. Sounds like whatever movement script your using is affecting the gun ins$$anonymous$$d of the camera.
Answer by joshmann971 · Jan 05, 2015 at 11:04 PM
Nevermind I fixed it, just had to reimport the 1st person controller and somehow it fixed itself! Thanks anyways everyone.
Answer by kevinspawner · Dec 29, 2014 at 03:09 AM
Drag and Drop your Gun Game object to the Camera.
Attach the movement script to the Camera.
Make sure the Gun Game object does not have nay movement related script attached to it.
Check the Collision. If Both the game object have physics collider, it might cause some issues. For instance if your camera has an movement script with rigidbody and collider and if you move the camera it may collide with the gun and will cause awkward movement.
Hope this helps.
I don't have any scripts on the gun gameobject, in the scene window it looks perfect, but on the game (when i play it) it moves funny. Still moves weirdly.
Your answer
Follow this Question
Related Questions
Attaching a Camera to the Player 3 Answers
How to set the position of objects on the left and right of the screen 0 Answers
Object doesn't stick on Camera right Corner?? (Basic Question) 1 Answer
Typecasting Camera to Object for ObjectField 3 Answers
How can I change camera when colliding with "X" object? 1 Answer