I’m having problems with the visibility of an object that pursues the player from behind. The object is a bone based model that was animated along a path in 3Ds and uses a sphere collider in Unity.
The game makes use of Unity’s 3rd person character controller and, thus, takes place in a 3D environment where we follow the player character. As the character, we trigger the instantiation of the aforementioned object via a collider trigger on the ground. We then have to constantly run away from the object. It follows us and kills the player when it catches him.
As can be seen in the hierarchy, the object is always instantiated correctly. However, the problem is that the object does not always become visible in Game View while chasing us and often pops up out of nothing in seemingly random spots.
Sometimes, it never shows up after being instantiated. Sometimes, it pops up in the wrong place, with the character already being INSIDE the object, without ever having seen it approaching from behind. Sometimes, it will actually pop up in front of the player after a while, having overtaken him without any sort of notice or consequence.
When passing the trigger slowly and walking away slowly, the object is more likely to show up correctly than it is when running away from the trigger at full speed and waiting for the object afterwards.
The behaviour seems to be largely random. One thing to note is that the object does NOT kill the player when invisibly passing him.
What’s weird is that all of this only happens in Game View. When watching the object’s behaviour in Scene View, the animation plays out flawlessly and the object follows its destinated path perfectly and is visible at all times and without any interruptions.
Furthermore, when using a split window design in Unity and having both the Scene View and Game View visible simultaneously, the objects behaves perfectly in Game View.
I’ve figured that the cameras I use might play a role in causing this issue. When running away from the object, it never becomes visible when approaching/passing us. When turning around and facing it, it usually becomes visible. When switching to another camera that makes the character turn his head to look behind him, the object usually becomes visible right away.
This leads me to believe that this is likely a visual problem. I’m not exactly positive on that though, as I don’t know how this would explain the object’s collider being defunct. If it was exclusively a visual problem, wouldn’t the player still be killed by the invisible object?
Anyway, could the camera somehow not render or clip the object if the root of the mesh is not ahead of the camera? Settings for ALL cameras are: near clipping plane = 0.3, far = 10000.
Or could this be something else? I’ll post any required code when necessary/requested.
Any advice is welcome.
Thanks in advance for any help,