Game Development Community

3rd Person Camera Slipping through objects

by Nicolai Dutka · in Torque Game Engine Advanced · 08/21/2009 (5:28 pm) · 5 replies

I'm having an issue with my 3rd person view that I need fixed. I have a video to show the issue which makes it clear what is happening.

The first 3.5 seconds of the video show the player walking backwards against a wall. The camera operates as expected here, colliding with the wall.

The rest of the video shows the camera 'popping out' past the walls when the player walks forward or rotates enough. I can't think of any other way to describe the issue, so here's the video:

s195.photobucket.com/albums/z83/kingdutka/?action=view&current=3rdPersonCam....

I have verified collisions on the object are working perfectly with ray casting and projectiles...

What can I do to prevent this?

#1
08/24/2009 (12:36 pm)
Anyone? It is very important that I get this issue fixed...
#2
08/24/2009 (2:54 pm)
It is possible the ray cast hits the player.
Try to remove PlayerObjectType from the mask.
#3
08/24/2009 (3:40 pm)
I went into the camera.cpp file and the only spot I could find was:

U32 mask = AtlasObjectType |
TerrainObjectType |
InteriorObjectType |
WaterObjectType |
StaticShapeObjectType |
PlayerObjectType |
ItemObjectType |
VehicleObjectType;

I tried removing the PlayerObjectType and got no difference at all... As you can see in the video, the camera is colliding with my object when the player walks backwards, but not when it walks forward... My guess is that the code is written to use a raycast facing backwards assuming the camera object will be behind the player in 3rd person view... Maybe we nust need to add a 2nd ray that checks forward too?

I have exported the player with the 'cam' node in a different position (backing it up) and now it doesn't pop through objects directly in front of you, but it does when you rotate your view (since the camera is offset to the right of the player for that 'over the shoulder' view).

It seems that the only fix is to have the camera not stick out past the bounds box of that player which completely ruins our 'over the shoulder' look...

Lastly, 'setCameraFOV' is doing absolutely NOTHING at all... I recall using this in a different game for a 'zooming' effect when aiming a sniper rifle, but it just isn't working at all for me...
#4
08/24/2009 (4:18 pm)
The raycast is backward,yes.
You need to trace out the math after you have the collision point.
#5
08/26/2009 (1:24 pm)
I tried simply reversing the raytrace by switching all "-" to "+" but it made no difference... I guess I did that one wrong or something...