User Interface Event Handlers – Talk
Jump to navigation
Jump to search
No edit summary |
Waffle SS. (talk | contribs) (Answered "onDraw" event handler question) |
||
Line 23: | Line 23: | ||
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] | 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] | ||
Checkout my example for [[drawLine]]. - [[User:Waffle SS.|Waffle SS.]] |
Revision as of 22:21, 27 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
Checkout my example for drawLine. - Waffle SS.