maruti borker wrote:
>
> I am trying to develop a normal walkthrough program in OSG . I am 
> trying use wasd for movement and mouse for rotation .
>
> W-front A-left D-right S-back .
>
> The wads part is done , but when it comes to mouse movement i am 
> facing a small problem .
>
> What i am trying to do is , i am calculating the change in x 
> co-ordinate and y co-ordinate of the mouse while it is moving . And i 
> am rotating according to value of dx and dy .I was able to do it quite 
> sucessfully .. but then i faced a problem . The problem as that i 
> couldnt rotate more when the pointer  is at a corner . coz near the 
> corner he cant move further and dx=0 or dy=0 . Thus i wasnt able to 
> move anything :( .
>
> so i thought of restoring the mouse pointer every frame to the center 
> of the window. For that i used requestWarpPointer() of 
> osgViewer::GraphicsWindow . But now the program is behaving weirdly 
> ... can u please check it out .. thanx in advance

Most likely the requestWarpPointer() call is generating a mouse movement 
event that is confusing the viewer.  A quick, hacky way to check this is 
to look at the new pointer position and ignore the event if it's exactly 
at 400,400 (make sure you call getX/getY, instead of 
getXnormalized,getYnormalized).

If this is the problem, you'll either have to figure out a different way 
to do this, or somehow detect whether the event came from a real mouse 
movement, or a warp pointer call.

The way we've done this is in the past to do wrapping of the pointer.  
When the pointer gets within X pixels of the side of the screen, warp it 
to the other side.  Of course, we had the advantage of doing our own 
low-level event handling, so we knew for certain when the pointer was 
moved.  You might get away with the same thing just by looking at the 
delta (just ignore the movement if the delta is greater than some 
value), but this could be error-prone.

-- 

--"J"

"I'm a castaway stranded in a desolate land,
 I can see the footprints in the virtual sand."
        --Neil Peart

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to