User Interface Event Handlers – Talk
Jump to navigation
Jump to search
Worldeater (talk | contribs) m (Possible use for the values returned by the "onMouseMoving" event of a display) |
No edit summary |
||
Line 19: | Line 19: | ||
(findDisplay 46) displayAddEventHandler ["MouseMoving", myhandler]; | (findDisplay 46) displayAddEventHandler ["MouseMoving", myhandler]; | ||
[[User:Worldeater|Worldeater]] 20:55, 10 October 2010 (CEST) | [[User:Worldeater|Worldeater]] 20:55, 10 October 2010 (CEST) | ||
---- | |||
How do you use the "onDraw" event? Also, how would one go about learning more about these? Are the code/commands in the config viewer somewhere? (A3) - [https://community.bistudio.com/wiki/User_talk:DreadedEntity DreadedEntity] |
Revision as of 02:31, 9 December 2014
The values returned by the "onMouseMoving" event of a display are most probably not "some kind of x and y delta position" but rotation angles. Treating these values as azimuth and elevation and applying them to, let's say, a camera results in a perfectly smooth camera movement:
mycam = "camera" camCreate (player modelToWorld [0, -5, 3]); mycam setDir getDir player; mycam cameraEffect ["INTERNAL", "BACK"]; showCinemaBorder false; ax = 0; ay = getDir player; myhandler = ' ax = ax + (_this select 2); ay = ay + (_this select 1); _cx = cos -ax; _cy = cos -ay; _sx = sin -ax; _sy = sin -ay; mycam setVectorDirAndUp [ [_cx * -_sy, _cx * _cy, _sx], [_sx * _sy, -_sx * _cy, _cx] ]; '; (findDisplay 46) displayAddEventHandler ["MouseMoving", myhandler];
Worldeater 20:55, 10 October 2010 (CEST)
How do you use the "onDraw" event? Also, how would one go about learning more about these? Are the code/commands in the config viewer somewhere? (A3) - DreadedEntity