API Question Joystick module vs. the VC camera re-centering feature

Moach

Crazy dude with a rocket
Addon Developer
Joined
Aug 6, 2008
Messages
1,581
Reaction score
62
Points
63
Location
Vancouver, BC
hi again...

my joystick module just leaped many miles in development, as it finally stopped CTD'ing and now successfully supports fully flexible axis-mapping on multiple devices via directinput :cheers:

but i ran into a wee bit of a bump along my ways...
i had to disable the stock Orbiter joystick feature, because it kept conflicting with my setup... no worries there... i just mapped all the axes to my new module


but it so happens that in doing this, i killed the POV hat...

so, ok, i'll re-program it... how hard can it be...

and indeed, hard it wasn't, but i'm getting trouble now from the re-centering feature that "pulls" the camera into alignment when near the center position in internal mode...
when i get near it, i get a lot of violent jitter, as my code pulls the camera one way, and Martin's code pulls it another :lol:...

this is how it looks:
Code:
static double camAZM, camPLR;
//
//
switch(jState.rgdwPOV[0])
{
	case 0:
	case 4500:
	case 31500:
			
		if(oapiCameraMode() == CAM_COCKPIT)
		{
			camAZM += CAM_MOVE_SPD;
			oapiCameraSetCockpitDir(camPLR, camAZM);
		} else
			oapiCameraRotPolar(-CAM_MOVE_SPD);

	break;
			
	case 22500:
	case 18000:
	case 13500:
			
		if(oapiCameraMode() == CAM_COCKPIT)
		{
			camAZM -= CAM_MOVE_SPD;
			oapiCameraSetCockpitDir(camPLR, camAZM);
		} else
		oapiCameraRotPolar(+CAM_MOVE_SPD);
			
	default:			
	break;		
}
		
switch(jState.rgdwPOV[0])
{
	case 13500:
	case 9000:
	case 4500:
			
	       if(oapiCameraMode() == CAM_COCKPIT)
		{
			camPLR -= CAM_MOVE_SPD;
			oapiCameraSetCockpitDir(camPLR, camAZM);
		} else
			oapiCameraRotAzimuth(CAM_MOVE_SPD);
					
	break;
				
	case 22500:
	case 27000:
	case 31500:
			
		if(oapiCameraMode() == CAM_COCKPIT)
		{
			camPLR += CAM_MOVE_SPD;
			oapiCameraSetCockpitDir(camPLR, camAZM);
		} else
			oapiCameraRotAzimuth(-CAM_MOVE_SPD);
				
	default:			
	break;		
}


note how i had to keep track of my own angles for internal mode, since theres no "oapiCameraGetCockpitDir" function :huh:

that's where the conflicts arise... as my angles play tug-of-war with the recentering feature :shrug:


how am i supposed to deal with this? would it be better to convert the directions to keyboard inputs instead? and if so, how do i do this in Orbiter2010?


cheerz!:tiphat:
 
Last edited:

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,320
Reaction score
25
Points
113
Location
Sydney, Australia
note how i had to keep track of my own angles for internal mode, since theres no "oapiCameraGetCockpitDir" function :huh:
IIRC, oapiCameraGlobalDir works in all camera modes.
EDIT: You'll want to transform that vector into local coordinates I expect:
Code:
VECTOR3 camDir;
GetRotationMatrix(&camDir);
MATRIX3 R;
GetRotationMatrix(R);
camDir = tmul(R,camDir);
 

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,282
Reaction score
17
Points
0
Location
Florida
GetRotationMatrix does not take a VECTOR3 as an argument.
 

Moach

Crazy dude with a rocket
Addon Developer
Joined
Aug 6, 2008
Messages
1,581
Reaction score
62
Points
63
Location
Vancouver, BC
hmm... ok i guess i can try going at it that way :thumbup:
but i don't have the project at my laptop, so it'll have to wait untill tonight... meanwhile, feel free to throw in some more ideas :cheers:
 

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,320
Reaction score
25
Points
113
Location
Sydney, Australia
GetRotationMatrix does not take a VECTOR3 as an argument.
:embarrassed: Thanks, that's what happens when you get too excited with Ctrl-C :p. What I really meant:
Code:
VECTOR3 camDir;
oapiCameraGlobalDir(&camDir);
MATRIX3 R;
GetRotationMatrix(R);
camDir = tmul(R,camDir);
 

Moach

Crazy dude with a rocket
Addon Developer
Joined
Aug 6, 2008
Messages
1,581
Reaction score
62
Points
63
Location
Vancouver, BC
well, i found me a better solution...

turns out, vsl->SetCameraCatchAngle(0); can turn off the camera catch function... so well... off it goes :shifty:



it's working now! much better! -- thanks anyways :thumbup:
 

Hielor

Defender of Truth
Donator
Beta Tester
Joined
May 30, 2008
Messages
5,580
Reaction score
2
Points
0
turns out, vsl->SetCameraCatchAngle(0); can turn off the camera catch function... so well... off it goes :shifty:
That's not really an acceptable solution for the glass cockpit or 2d panel modes, since that'll make it nearly impossible to find the HUD again.
 

Moach

Crazy dude with a rocket
Addon Developer
Joined
Aug 6, 2008
Messages
1,581
Reaction score
62
Points
63
Location
Vancouver, BC
yes, i'm aware of that... i also found that my solution fails as it disrespects the camera panning boundaries :(

i think i'll try going at it by somehow bypassing instructions to the default camera handling methods... perhaps by raising keyboard events... which leads to the question: how? :shrug:
 
Top