- Home /
FPS camera movement breaks GameObject
Dear Friends I do wasted alot of time to solve this one stupid thing with this First Person Controller Camera.
I have a weapon that contains alot of parts in it that are parented to weapon. And weapon is parented to Camera inside FPS controller.
Here is the deal (And it not happens when I parent it outside the camera) :
When I run the game preview everything is alright while I move camera horizontally but when I move it verticaly the all parts from "weapon" just gets messed up. they do move in needed direction but each on their own and they all clip through each other. The picture looks very bad from this point.
Only happens with this camera and only if anything is parrented to it.
Please can anyone describe this problem as it is. And explain how to solve it. And I did look though all the advices currently on these forums and didn't find simple solution to this.
Thank you.
I attached the image from my most recent tutorial area for testing out stuff. Here you can see the problem (and here Is no scripts placed by me so they cant be the reason)
try putting every parts of the weapon under an empty gameobject and parent the empty gameobject to the camera.Or at-least show the hierarchy view
Here is your image. But I have already writen that i did exactly as you said. Nothing has changed.
When you run the game in preview mode, select something like "Blade" - all its transformation etc info in the Inspector should remain 0 0 0 as you look around. Does it?
Yes, It's quite interesting but It does stays the same for x,y and z.
Let me describe thing more properly..
It happens with all parts of any object. Only happens when you move camera up or down in preview mode. And last as you can see from the images when camera goes up the object also get further from it so the camera doesnt center with the object but ins$$anonymous$$d orbits around it. But while it does all parts goes right through each other.
Answer by darkhog · Nov 02, 2013 at 06:09 PM
I probably say this blindly (without access to code you are using), you should only move/rotate root of the object (Melee), not any of the others. Also, in case if you are using physics colliders, make sure weapon parts doesn't collide which each other. There is API call for that:
Physics.IgnoreCollision(collider1, collider2);
Make sure that conected object doesn't clash with each other.
Also, seeing code you use both for moving weapon and fps camera will be REALLY helpful.
It sounds kind of blindly. But logicaly. But the problem is I removed all colliders from each part. and even if I try to do any transformation with just parent object and not its child the effect stays the same.
Answer by Strikerg2216 · Nov 03, 2013 at 11:27 AM
Yup the mistery is solved, finally... I was seriously right when I said its all because of naming. Everyone who has similar problems look here When you name any child or parent object before parenting you will have different camera distortions , dont know why, dont care. So here what you need to do - Before adding any objects or renaming Empty object place it as you like then whyle its still Empty Object parent it anywhere you need then add child objet to it and only then rename it. Step - by - Step
Your answer
Follow this Question
Related Questions
Camera Relative Movement 2 Answers
Script that stays behind player that rotates the player along with the camera/mouse (third person) 0 Answers
(2d in 3d) Movement relative to camera using JS 0 Answers
Camera behavior the same as the unity editor has 2 Answers
Orient GameObject rotation to rotation of Main Camera 0 Answers