diff options
author | Jorge Bernal <jbernalmartinez@gmail.com> | 2014-06-26 02:47:30 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2014-06-26 02:47:37 +0400 |
commit | 7d99a4ded9d3d24c24ea2d5bcc488469cf60fa4a (patch) | |
tree | f56a5cb74013a4e0520e668570e9fe9f6d1d4a6a /source/blender/blenkernel/intern/sca.c | |
parent | 11d1fea2850dd4071268034b133c924ce6396df9 (diff) |
BGE: New Mouse Actuator
Disclaimer: The author of this patch is Geoffrey Gollmer (gomer). I only updated the patch to the current git master status, reworked several parts to fit well with current coding style and applied several fixes.
This actuator allows users to show/hide the mouse cursor using logic bricks, as well as control object rotation with a mouse in the BGE.
The mouse rotation is flexible enough to allow any type of mouse look, as well as banking for flight controls.
{F94520}
{F91859}
Blend file for testing Mouse actuator (with default parameters and crosshair): {F94920}
Reviewers: moguri
Reviewed By: moguri
CC: gomer, lordodin
Differential Revision: https://developer.blender.org/D559
Diffstat (limited to 'source/blender/blenkernel/intern/sca.c')
-rw-r--r-- | source/blender/blenkernel/intern/sca.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index b0b64cac802..1310162483e 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -391,6 +391,7 @@ void init_actuator(bActuator *act) bSoundActuator *sa; bSteeringActuator *sta; bArmatureActuator *arma; + bMouseActuator *ma; if (act->data) MEM_freeN(act->data); act->data= NULL; @@ -477,6 +478,15 @@ void init_actuator(bActuator *act) sta->flag = ACT_STEERING_AUTOMATICFACING; sta->facingaxis = 1; break; + case ACT_MOUSE: + ma = act->data = MEM_callocN(sizeof( bMouseActuator ), "mouse act"); + ma->flag = ACT_MOUSE_VISIBLE|ACT_MOUSE_USE_AXIS_X|ACT_MOUSE_USE_AXIS_Y|ACT_MOUSE_RESET_X|ACT_MOUSE_RESET_Y|ACT_MOUSE_LOCAL_Y; + ma->sensitivity[0] = ma->sensitivity[1] = 2.f; + ma->object_axis[0] = ACT_MOUSE_OBJECT_AXIS_Z; + ma->object_axis[1] = ACT_MOUSE_OBJECT_AXIS_X; + ma->limit_y[0] = DEG2RADF(-90.0f); + ma->limit_y[1] = DEG2RADF(90.0f); + break; default: ; /* this is very severe... I cannot make any memory for this */ /* logic brick... */ |