Game Development Community

camera clipping

by Martin Banks · in Torque 3D Professional · 09/24/2009 (5:42 pm) · 6 replies

Is there a setting to control how close the third person camera gets to the player? I'm tryin to eliminate the camera following up right through the character when they approach a wall then turn away from it.

#1
10/01/2009 (12:09 pm)
In the new release 1.0, I can see that the camera follows Gideon without penetrating his mesh in the third person. This is the case even when I get close to a wall and turn; the camera follows, but always avoids showing the inside of his mesh.

How is this working so well in the FPS example? Are there settings for the interior geometry?
#2
10/01/2009 (12:20 pm)
It is the ray cast.
It hits the player and the camera recalculates the new position.
That's how the camera avoids the player.
#3
10/01/2009 (12:29 pm)
@Picasso

My problem is that the camera is not avoiding the player. In third person, while following it runs right up through the back of the player and penetrates the mesh. In the worst case, if there is no movement, it sits showing the mesh internals.

I've tried various settings for minCamera and maxCamera distance, but nothing prevents the penetration.

I'm using a collada model. I noticed that the Gideon model is a dts, and that its collison method is collison mesh. My collada model, while of course,is translated to a cached .dts, uses bounds collision. Could it be that the follow camera's bounds checking does not respect bounds collision?


#4
10/01/2009 (1:45 pm)
Player's collision box(AABB) is built runtime.
The camera does not possess a collision box.
That's why you should produce a more complex logic to avoid penetrations.
For example you can move the start point of the raycast to be a little distance back from the player,or you can roll up the camera position (like 'Max Payne 2').
It can be done using Euler rotation or .. quaternions.
#5
10/09/2009 (5:52 pm)
I tried this with the gideon character in my scene and still the camera penetrates. My interiors where set as visibility collision, so I made a test with an interior set to collision mesh, like in the berg fps example. But still the follow cam approaches and goes right through! I even copied the datablock settings from the fps example berg, and still penetration.

s620.photobucket.com/albums/tt287/softydevel/?action=view&current=penetratin...

Here is the berg scene, same character. No penetration.
s620.photobucket.com/albums/tt287/softydevel/?action=view&current=Notpenetra...

This can't just be the result of bounding boxes. But it seems as though, the camera tracking is more robust and respects the bounding boxes within the burg scene.

any thoughts anyone?
#6
10/12/2009 (5:49 pm)
Ok, I think I've narrowed down the culprit factor that leads to follow camera penetration: size of the object being followed.

I was able to make this problem go away, by scaling up my environment to 20 times its size. It was very much smaller than the burg scene, and when I was testing out my character in the burg scene and not getting penetration, I had scaled my character up by 20.

Now with my character scaled up in my scene (and as a result having to scale the entire scene, being that its an interior), the camera stops where the bounding box is defined.

Awesome?

Seems like when the camera's transform is computed, the camera raycast misses the character if it is too small, so it goes right through it.