Hello,
I’m trying to get a camera to collide with a mesh, however at the moment I’m having difficulties getting the desired behaviour.
I am making an endless runner type game set in a tunnel. Each piece of the tunnel is comprised of sections featuring obstacles that the play must avoid to progress. To avoid these obstacles the player (camera) must rotate around tunnel.
The problem I have is that when the camera hits an obstacle in the tunnel it passes straight through it. That is unless I turn off all constraints on the rigidbody. If I do that the camera will collide with the obstacle but then a force is applied to both objects. What I would like is for the camera to collide with the obstacle, but no forces to be applied to either, the camera simply should not pass through the obstacle. This also applies to situations where the camera might need to jump onto a mesh within the level as well.
As mentioned above, if I freeze the position and rotation constraints both the camera and obstacle remain fixed on collision (no forces are applied), but the camera passes through. Both the obstacle and the camera have rigidbodies, and box and sphere colliders components respectively.
As far as I can tell this should be fairly simple, however my understanding of Unity’s physics system is minimal so it’s a lot more complicated than it should be!
Any assistance is greatly appreciated. Thanks.