Thanks alot! It seems I was closer to the solution on my first attempt than on the latter.

I implemented as-is and it worked great! (excluding some special cases)
http://www.youtube.com/watch?v=cGHNkYPWsJU

The first 1:45 of the video is showing the "pathfinding" working flawlessly.
At 1:45 I start showing the special cases where it dosn't.

Observing this strange behaviour I think I have discovered why it messes up. It seems like it is happening when it reaches the equivalent point, but on the opposite side of the planet. In the video you can observe this not only happens when traveling north-to-south or south-to-north poles, it also happens with any opposite points (West-to-East, NE-to-SW, etc...)

I have designed a function to detect if the point is on the same side of the planet or not (relative to a plane cut oriented by the Origin's normal from the planet core).

Code:
int hemisphere_compare(VECTOR* Origin, VECTOR* Destination, ENTITY* Planet)
{
	VECTOR Plane_Normal;
	VECTOR Point;
	int hemisphere;
	
	//get values relative to planet core
	vec_diff(Plane_Normal,Origin,Planet.x);
	vec_diff(Point,Destination,Planet.x);
	//normalize vectors
	vec_normalize(Plane_Normal,1);
	vec_normalize(Point,1);
	
	//calculate hemisphere of Destination
	//relative to a plane-cut oriented by Origin's normal
	hemisphere=vec_dot(Plane_Normal,Point);
	
	if(hemisphere>0)//if on my same hemisphere
	{
		return(1);
	}
	else//if on opposite hemisphere
	{
		return(0);
	}
}




This function should be usefull to fix the problem, but I'm not sure where to plug this in your function (probalby above the last two lines, to do something different with those last two lines afterwards?).
But what I am mostly confused with is... how to modify that last part of your function depending on the results of mine?

current brain status: dazed and confused
confused

EDIT:
I have done further tests drawning an axsis going through the planet's core aligned to our vehicle's normal (blue line).
http://www.youtube.com/watch?v=a-1EbjmkwMk
This proves the problem is not when going through the same point on the opposite side?
current brain status: even more dazed and extremely confused...

EDIT2:
Done further tests, this time debugging V_Path (green line).
V_Path is the temporary path for the pan calculations. It is a rotated version of our destination.
http://www.youtube.com/watch?v=ntPkiiZTV8Y
Aha! Finally found the culprit! It seems the problem occurs when our temporary path is aligned vertically.
(I'm a little less confused now, I understand what is causing this but it seems I can't figure out how to fix it)

Last edited by Carlos3DGS; 01/18/12 18:16. Reason: further testing and example videos

"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1