- Home /
3rd Person Cam Collides when it shouldn't
Hi there
I'm making a Lunar Lander type rocketflying game in Unity. I have my rocketobject with all the movement scripts attached, and my camera is its child, following it wherever it goes. The known problem here is the cam clipping through objects/the terrain. So I attached an invisible sphere to the camera (around the camera) to prevent it from clipping through the floor.
When the rocket flies at a certain speed and collides with the terrain it explodes - the problem now is that it also explodes when the sphere around my camera collides with the terrain!
Is there a way around this without completely rebuilding everything? Or what would the best structure of objects be (I have player > cam > camsphere).
Thanks for any ideas and tipps!
this is a very known issue that has bugged me for a long time too: composite colliders. this happens because the camera is a child to your ship and its collider is used as one combined with the ship's collider, according to this:
http://docs.unity3d.com/Documentation/Components/class-Rigidbody.html
you must find a way to keep your camera attached to your ship without a parent/child relationship, maybe link it to the ship using a fixed joint? but this way if the camera collides with the terrain and it changes position, it will also affect your ship's motion through the joint...! i hope at least you can find a way to handle your camera's position in another way without changing the ship's motion too...!
Answer by jmatthews · Mar 25, 2013 at 06:24 PM
Unless i misunderstand the question you should be able to provide a custom physics layer, tag the camera sphere as belonging to that layer and then go into your physics settings and have the two not interact.