JRowe Posted January 13, 2009 Posted January 13, 2009 (edited) I'm trying to work out a "relative" version of the Smoother mouse move.This code demonstrates a relative mouse move, from the screen center context, as in a 3D game, where instead of the pointer moving, your whole view moves. When a game traps your mouse, this is the context.Func _MouseMoveRelative ($iX, $iY) Local Const $MOUSEEVENTF_MOVE = 0x01 DllCall ("user32.dll", "int", "mouse_event", _ "int", $MOUSEEVENTF_MOVE, _ "int", $iX, _ "int", $iY, _ "int", 0, _ "int", 0) EndFuncThis is the "Smoother Mouse Move" script by DtTvB, which creates a 2 point spline path and moves the mouse point along it. I want to use this in a relative fashion, for smooth camera transitions w/ au3irrlicht.CODE; Smoother Mouse Move; by the DtTvB; Ease in functionfunc __calci1($i, $sm) return $i ^ $sm;endFunc; Ease out functionfunc __calci2($i, $sm) return 1 - ((1 - $i) ^ $sm);endFunc; Ease in out functionfunc __calci($i, $sm) if ($i < 0.5) then return __calci1($i * 2, $sm) / 2; else return (__calci2(($i - 0.5) * 2, $sm) / 2) + 0.5; endIfendFunc; Ease backward functionfunc __calof($i, $sm) if ($i < 0.5) then return __calci($i * 2, $sm); else return __calci((1 - $i) * 2, $sm); endIfendfunc; MAIN FUNCTIONfunc mouseMove2($x2, $y2, $m) $x1 = mouseGetPos(0); $y1 = mouseGetPos(1); $xv = random(-100, 100); $yv = random(-100, 100); $sm = random(1.5, 2); for $i = 0 to $m $ci = __calci($i / $m, $sm); $co = __calof($i / $m, $sm); $cx = $x1 + (($x2 - $x1) * $ci) + ($xv * $co); $cy = $y1 + (($y2 - $y1) * $ci) + ($yv * $co); mouseMove ($cx, $cy, 0); nextendFuncfixed some copy/paste issues Edited January 13, 2009 by JRowe [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
JRowe Posted January 14, 2009 Author Posted January 14, 2009 Anyone got an idea? I've tried replacing mousemove in the script with the mousemove2 function, and it doesn't work. It ends up pointing the camera straight up. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
JRowe Posted January 14, 2009 Author Posted January 14, 2009 I think I might need to visit a math forum for this one, lol. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now