http://www.youtube.c...eiid-Uw#t=2m45s (2m45s)
[font="arial, sans-serif"]Johnny Chung Lee (who uploaded this video) used the Wii mote for head tracking, I want to do the same thing with a Kinect & OpenNI.[/font]
[font="arial, sans-serif"]However, my problem isn't related to the kinect or head tracking...[/font]
[font="arial, sans-serif"] [/font]
[font="arial, sans-serif"]My problem is that I'm having a hard time to wrap my head around setting up correct View and Projection matrices to look into a tunnel as shown in the youtube video.[/font]
[font="arial, sans-serif"]Here's an example:[/font]
[font="arial, sans-serif"]
[/font]
[font="arial, sans-serif"][font="arial, verdana, tahoma, sans-serif"]
[font="arial, sans-serif"]Right now I just want to get this step to work, so I'm using keyboard input to move my camera around.[/font]
[font="arial, sans-serif"]It doesn't make much sense to do any head tracking before I got this working.[/font][/font][/font]
[font="arial, sans-serif"]My problem is figuring out the correct View & Projection matrices for an arbitrary camera position in front of the TV screen, so the camera actually looks "through the screen".[/font]
[font="arial, sans-serif"]Here is what I tried:[/font]
[font="arial, sans-serif"] [/font]
[font="arial, sans-serif"]
//Position = Camera Position
View = Matrix.CreateLookAt(Position, new Vector3(Position.X, Position.Y, 0), Vector3.Up);
//Create a perspective off center
//The tunnel model is 16f wide and 9f high (My TV is 16:9, resolution is 1920x1080)
//near and far planes are 0.05f & 500f
float left = nearPlane * (-16f + Position.X) / Position.Z;
float right = nearPlane * (16f + Position.X) / Position.Z;
float bottom = nearPlane * (-9f - Position.Y) / Position.Z;
float top = nearPlane * (9f - Position.Y) / Position.Z;
Projection = Matrix.CreatePerspectiveOffCenter(left, right, bottom, top, nearPlane, farPlane);
[/font][font="arial, sans-serif"] [/font]
[font="arial, sans-serif"]Oddly enough this seems to work on the Y axis, but not on the X axis?[/font]
[font="arial, sans-serif"]If I move the camera up or down I get the wanted effect.[/font]
[font="arial, sans-serif"]However if I move it left or right it just scrolls past the edge of the tunnel [/font][font="arial, sans-serif"](the perspective does not change)[/font][font="arial, sans-serif"]. :/[/font]
[font="arial, sans-serif"]I think I'm missing something here, but I can't figure out what it is.[/font]
[font="arial, sans-serif"] [/font]
[font="arial, sans-serif"]Any ideas / suggestions what I could try?[/font]
[font="arial, sans-serif"] [/font]
[font="arial, sans-serif"]Cheers,[/font]
[font="arial, sans-serif"]Hyu[/font]
[font="arial, sans-serif"] [/font]
[font="arial, sans-serif"] [/font]