Please Help - Gliding View

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
Alex
Posts: 24
Joined: Sun Feb 13, 2011 6:24 pm

Please Help - Gliding View

Post by Alex »

Hey guys,
So I posted this in the QuakeC section, but it may be more of an engine programming thing so after about a week I'm going to give it a go here.

I need the player view to remain stationary while being able to move the cursor/crosshairs. I was pointed towards cl_prydoncursor in Darkplaces, which worked great, except for one bug: I'm not using a conventional mouse.

When using a normal mouse the cursor in this mode "goes" to where you point. The problem is that I'm not using a normal mouse, I'm experimenting between using a wii remote or a laser pointer (and using laser tracking software with a webcam). When I use either of these as my mouse the in game cursor "glides".

What I mean is that if my pointing isn't completely centered, the view drifts towards whichever direction I'm pointing. I can't point to the right and have the cursor move to the right and stop. Pointing to the right means I'll continually keep spinning right.

In Windows my improv mouse works just as I want it to. I point halfway across the screen and the cursor moves half way across the screen and stops. In dark places, it just keeps going, gliding.

Does anybody have ANY suggestions that might help? I've been going nuts here. Is this something I can modify in QC with the Prydon cursor vectors (ie. .vector cursor_screen or .vector cursor_trace_endpos)? Or is this going to have to be an engine modding thing? I've noticed that the windows cursor is automatically centered and locked as soon as I run quake, would this have anything to do with it? Does it have anything to do with mouse acceleration?

I'd like if at all possible to stay away from engine modding for the time being as I'm not familiar with it.

Here's the laser tracking software I'm using which is really cool stuff

http://channel9.msdn.com/coding4fun/art ... nteraction

You'll need a webcam, laser pointer, and Visual C# to compile the source and run the program (which is found somewhere on that website as well). For those who just want to see the source, here's the important part (I think) as it pertains to mouse movement


private void ControlCursor(int x, int y, bool click)
{
//Get screen width and height
int screenWidth = Screen.PrimaryScreen.WorkingArea.Width;
int screenHeight = Screen.PrimaryScreen.WorkingArea.Height + 34;

float cursorX, cursorY;

//Compute location of laser dot into camera coordinates
if (_mForm.invertCursorMovements == true)
{
cursorX = screenWidth - (((float)screenWidth / imageWidth) * x);
cursorY = screenHeight - (((float)screenHeight / imageHeight) * y);
}
else
{
cursorX = ((float)screenWidth / imageWidth) * x;
cursorY = ((float)screenHeight / imageHeight) * y;
}

//Set cursor position
Cursor.Position = new Point((int)cursorX, (int)cursorY);

if (click == true)
{
leftMouseButtonDown = true;
}

}
}
}


I plan to create a training platform where a rife becomes your aiming device, a glorified wii shooter kind of thing. It's crucial though that real life aiming matches in-game aiming, otherwise the real life weapon sights are useless.

Any help would be great, I've been going nuts here.

Thanks,
Alex
Post Reply