3rd Person Camera Bug TGE1.4-1.5.2
by Alex (Stalker) Sakablukow · in Torque Game Engine · 10/19/2007 (3:37 am) · 5 replies
I have a issue with 3rd Person Camera.
I have tested it with clean TGE 1.4, 1.5, 1.5.2, and its the same.
The Camera get throught the terrain, and you can see terrain and objects at the other site.
Here are a few examples:
TGE 1.4.0
TGE 1.5.2
Know anyone how to fix that? Maybe it was already fixed? Have searched in the forum, but nothing found until yet.
It will be great, if someone can help!
I have tested it with clean TGE 1.4, 1.5, 1.5.2, and its the same.
The Camera get throught the terrain, and you can see terrain and objects at the other site.
Here are a few examples:
TGE 1.4.0
TGE 1.5.2Know anyone how to fix that? Maybe it was already fixed? Have searched in the forum, but nothing found until yet.
It will be great, if someone can help!
#2
that were done in that thread.
This might be just the camera fix I've been needing.
10/19/2007 (9:09 am)
Very cool stuff Brian. You should post that as a resource with the updatesthat were done in that thread.
This might be just the camera fix I've been needing.
#3
10/20/2007 (6:34 pm)
Unfortunately this fix kills the advanced camera system. No idea why, but none of the modes work anymore.
#4
That camera uses a similar function, try something like this:
I think I got the basics for this fix from the advanced camera thread (or one of them).
Advanced Camera only version
10/20/2007 (11:04 pm)
Lol, this fix doesn't even touch the advanced camera. How can it break something entirely unrelated? If you're using the advanced camera you shouldn't be using that fix..That camera uses a similar function, try something like this:
I think I got the basics for this fix from the advanced camera thread (or one of them).
Advanced Camera only version
Point3F AdvancedCamera::runCameraCollisionCheck(const Point3F& startpos, const Point3F& endpos) {
U32 mask = TerrainObjectType |
InteriorObjectType |
WaterObjectType |
StaticShapeObjectType |
PlayerObjectType |
ItemObjectType |
VehicleObjectType;
RayInfo collisionInfo;
Point3F offsetStart = startpos;
offsetStart.z += mCurrentLookAtOffset.z;
Point3F LookDir = endPos - offsetStart;
LookDir.normalize();
Point3F AntiClippingOffset = LookDir * DISTANCE_FROM_COLLISION;
// Cast ray and check for collision with terrain and interiors
if (!gClientContainer.castRay(offsetStart, endpos + AntiClippingOffset, mask, &collisionInfo)) {
// No collision, so return endpos
return endpos;
} else {
// We collided, so return the point of collision minus our clipping offset
return collisionInfo.point - AntiClippingOffset;
}
}
#5
Unfortunately the "basic" camera fix don't work for me, the advanced camera fix hasn't worked, but maybe because i use interpolation, and the camera interpolate throught the terrain.
(I use both, the basic torque camera and the advanced camera.
I will try now your ressource...
Update:
With gameCamera i have exact the same problem:
10/22/2007 (12:05 am)
Thix for Help @Brian West.Unfortunately the "basic" camera fix don't work for me, the advanced camera fix hasn't worked, but maybe because i use interpolation, and the camera interpolate throught the terrain.
(I use both, the basic torque camera and the advanced camera.
I will try now your ressource...
Update:
With gameCamera i have exact the same problem:
Torque Owner Michael Bacon
Default Studio Name
Barring that try replacing Camera::validateEyePoint with something like this:
void Camera::validateEyePoint(F32 pos, MatrixF *mat) { if (pos != 0) { // Use the eye transform to orient the camera Point3F dir; mat->getColumn(1, &dir); pos *= mMaxOrbitDist - mMinOrbitDist; // Use the camera node's pos. Point3F startPos = getRenderPosition(); Point3F endPos; // Move half a meter away from collision objects Point3F AntiClippingOffset = dir * -0.5; // Make sure we don't extend the camera into anything solid if(mOrbitObject) mOrbitObject->disableCollision(); disableCollision(); RayInfo collision; U32 mask = TerrainObjectType | InteriorObjectType | WaterObjectType | StaticShapeObjectType | PlayerObjectType | ItemObjectType | VehicleObjectType; Container* pContainer = isServerObject() ? &gServerContainer : &gClientContainer; if (!pContainer->castRay(startPos, endPos + AntiClippingOffset, mask, &collision)) endPos = startPos - dir * pos; else endPos = collision.point - AntiClippingOffset; mat->setColumn(3,endPos); enableCollision(); if(mOrbitObject) mOrbitObject->enableCollision(); } }I don't know whats wrong with the original code but this should get you going.