All pastes #717016 Raw Edit

Miscellany

public text v1 · immutable
#717016 ·published 2007-09-27 09:48 UTC
rendered paste body
note: all angles are in degrees. 360 is the same as 0 is the same as -360. ok?

initialise variables drag, R, Q1, QQ1, Q2, QQ2, Q4, Q5, targetRotation
set drag to a suitable value ( i use 8)
set everything else to 0
do the following every frame:{
    use trigonometry to get the angle between the mouse and the pointer, and set it to a variable targetRotation
    if targetRotation<0:{
        add (targetRotation-QQ1) to Q1
    }
    set QQ1 to targetRotation;
    if targetRotation>0:{
        add (targetRotation-QQ2) to Q2
    }
    set QQ2 to targetRotation;
    if Q3-180>targetRotation:{
        add 360 to Q1
    }
    Q3 = targetRotation;
    if Q4+180<targetRotation:{
        subtract 360 from Q2
    }
    set Q4 to targetRotation
    set Q5 to Q1+Q2;
    rotate object by:(Q5-R)/drag
    (in other words, add (Q5-R)/drag to the rotation attribute of the object)
}