Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: on rotation, cursor moves for a spherical screen, not a flat

  1. #1

    on rotation, cursor moves for a spherical screen, not a flat

    Hello,

    When programming glovepie to control left4dead2 with the wiimote, tried to take in account the positioning of the device relatively to the screen, to have a better pointing device feel.

    The effect is visible when you use the device to control the desktop cursor.

    Actually the way the cursor moves according to wrist rotation is ideal only if the screens where spherical.
    You turn the wrist one degree an the cursor moves 1 pixel
    Since the screen is flat it should have a motion of tan(1 degree)


    So the code was this
    Code:
         var.gyroPitch=wiimote.MotionPlus.GyroPitch
         var.gyroYaw=wiimote.MotionPlus.GyroYaw
    
         var.pitchrange=3000 mickeys
         var.yawrange=6000 mickeys
    
         // proportional to angle  (rotate )
         //var.diy=MapRange(wiimote.gyroPitch, -90 degrees,90 degrees, var.pitchrange mickeys,-var.pitchrange mickeys)
         //var.dix=MapRange(wiimote.gyroYaw, -90 degrees,90 degrees, -var.yawrange mickeys,var.yawrange mickeys)
    
         // proportional to pointed surface (aiming)
         var.diysin=-MapRange(tan(wiimote.gyroPitch), -1, 1, -var.pitchrange mickeys, var.pitchrange mickeys)
         var.dixsin=MapRange(tan(wiimote.gyroYaw), -1, 1, -var.yawrange mickeys,var.yawrange mickeys)
    
    
       If Wiimote.A
            mouse.DirectInputX += delta(var.dixsin)
            mouse.DirectInputY += delta(var.diysin)
            Wiimote.led4=true
       else
         Wiimote.led4=false
       endif
    When you face the screen, if you rotate the pointer +10° on yaw axis, the mouse cursor should move on the screen by a trigonometric function of x=k*tangeant(10°)

    Actually it seems it's linear, and the cursor moves linearily with the wrist rotation, like x=k*10° .


    This is interesting in FPS, because it create a natural rotate acceleration the more you go away from the center.
    It means :
    - you can look around very quickly, even behind you with a reduced wrist movement
    - you still have a good precision when you are pointing around the center of the screen
    - you don't need to rachet as much when doing wide movements.


    Sine function is the simplest way to do that, but ideally we should be able to customise the curb, so we can choose the treshold where we trade aiming precision for wide movement quickness.

  2. #2

    Re: move cursor according to SINUS(YAW) instead of LINEAR(YAW)

    I don't understand what you mean by SINUS. Perhaps you could elaborate further?

  3. #3

    Re: move cursor according to SINUS(YAW) instead of LINEAR(YAW)

    I meant the trigonometric function "sine"
    http://en.wikipedia.org/wiki/Trigonomet ... nd_tangent

    "sinus" is the french name, I didn't realised it was not the same in english

    "yaw" is the vertical axis on wich we rotate to look left and right

    d is your distance to the monitor
    yaw=0 degree means you point in front of the screen
    then if you rotate from yaw=0 to yaw=10
    the cursor on the screen should move of a distance equal to d*sine(10)

  4. #4

    Re: move cursor according to K*SINE(YAW) instead of K*YAW

    Okay so what benefit does multiplying the distance from the base station or monitor by a position on a sine wave

    distance * function return

  5. #5

    Re: move cursor according to K*SINE(YAW) instead of K*YAW

    read above

  6. #6

    Re: move cursor according to K*SINE(YAW) instead of K*YAW

    Yea I've read this part, about 6 times

    When you face the screen, if you rotate the pointer +10° on yaw axis, the mouse cursor should move on the screen by a trigonometric function of x=k*sine(10°)

    Actually it seems it's linear, and the cursor moves linearily with the wrist rotation, like x=k*10° .


    This is interesting in FPS, because it create a natural rotate acceleration the more you go away from the center.
    It means :
    - you can look around very quickly, even behind you with a reduced wrist movement
    - you still have a good precision when you are pointing around the center of the screen
    - you don't need to rachet as much when doing wide movements.


    Sine function is the simplest way to do that, but ideally we should be able to customise the curb, so we can choose the treshold where we trade aiming precision for wide movement quickness.
    Maybe I am just tired, but it seems to make less sense each time I read it. It is the type of explanation I usually get from my best friend who has been programming since he was 6 when I ask him how code on a particular project is coming. Complicated and missing the vital parts required for a simple explanation.

    I understand the point of this is to make controlling your view easier. The part I don't understand is how using a trigonemtric function which repeats its outputs every 2 pi will accomplish this.

    Increased sensitivity would allow
    "- you can look around very quickly, even behind you with a reduced wrist movement"
    "- you don't need to rachet as much when doing wide movements."
    and a good setting for your acceleration would allow
    "- you still have a good precision when you are pointing around the center of the screen"


    edit: Oh I forgot wand mode. I haven't tested it, but I am fairly certain if used in an fps it would also provide similar results.

  7. #7
    Senior Member
    Join Date
    Jul 2010
    Posts
    207

    Re: move cursor according to K*SINE(YAW) instead of K*YAW

    I think basketor wants cosine for acceleration.

  8. #8

    Re: move cursor according to K*SINE(YAW) instead of K*YAW

    Oh, and then the acceleration variable could just be dropped off. I see, that could make configuration a lot simpler.

  9. #9

    Re: move cursor according to K*SINE(YAW) instead of K*YAW

    Quote Originally Posted by MrMormon
    I think basketor wants cosine for acceleration.
    It's tangent.
    I thnik I got mislead by an old script I used, wich is not the last one.



    The controler is in A
    The screen is on the line BC, C beeing in the center of the screen.
    A is angle BAC
    So it's tangent(A)=a/b
    a=b*tangent(A)

    You see, the more we open the A angle, the faster the cursor should move on the screen.
    That's the best way to oontrol a mouse cursor on the desktop because the cursor moves the same way would move a red dot on the screen with a laser light.

    In a fps I prefered it this way also.

  10. #10

    Re: move cursor according to K*TANGENT(YAW) instead of K*YAW

    So all this is just so that depth can be taken into account? Speaking of which your diagram can either be considered wrong or your suggestion lacking details. There is no measurement of the distance away from the monitor. Especially when for people like me, having the hydra base close to the monitor causes jitter. Which is strange cause I have an LCD, but oh well.

    Since the diagram becomes useless without the monitor, I'm gonna go with missing details. The alternative means there is no right angle in the triangle (B = base; H = hand; Y = you)
    If you don't mind doing it with non right angles have at'r

    The Sine Rule

    a / sin A = b / sin B = c / sin C

    The Cosine Rule

    cos A = (b2 + c2 - a2)/2*b*c
    cos B = (c2 + a 2 - b 2)/2*c*a
    cos C = (a2 + b 2 - c 2)/2*a*b


    tan Θ = sin Θ / cos Θ

    I don't mind proving a trig identity, but calculating stuff.. not so much. In any case the non right angle triangles are more accurate to how things actually are.

    Edit: The more you open the angle (ie. bigger angle) the slower it should move actually. You place your hand closer to the monitor in your diagram and the angle becomes wider. Then it becomes a much larger motion of your wrist to point to either side of the monitor.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •