C++ SDK Reference  12.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyIGuyController.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) 1992-2013 Boston Dynamics
4  * ALL RIGHTS RESERVED.
5  *
6  * These coded instructions, statements, and computer programs
7  * contain unpublished proprietary information of Boston Dynamics
8  * and are protected by Copyright Laws of the United States.
9  * They may not be used, duplicated, or disclosed in any form, in
10  * whole or in part, without the prior written consent from Boston
11  * Dynamics.
12  *
13  * RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the government is subject
15  * to restrictions as set forth in FAR 52.227.19(c)(2) or
16  * subparagraph (c)(1)(ii) of the Rights in Technical Data and
17  * Computer Software clause at DFARS 252.227-7013 and/or in
18  * similar or successor clauses in the FAR, or the DOD or NASA
19  * FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the
20  * Commercial Computer Software--Restricted Rights at 48 CFR
21  * 52.227-19, as applicable. Unpublished-rights reserved under
22  * the Copyright Laws of the United States.
23  * Contractor/Manufacturer is:
24  * Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.
25  */
26 
27 /*********************************************************************
28  **
29  *t diguyIGuyController
30  **
31  */
32 
33 #ifndef __diguyIGuyController_H
34 #define __diguyIGuyController_H
35 
36 #ifdef SWIG
37 %module diguyIGuyController
38 #else
39 #define CPLUSPLUS_ONLY
40 #endif
41 
42 #ifdef CPLUSPLUS_ONLY
43 
44 #include <declspec_diguy.h>
45 #include <diguyMotionPosture.h>
46 #include <diguyMotionVariant.h>
47 
48 class bdiScenarioIGuy;
49 class diguyCharacter;
50 
51 #endif
52 
53 
54 /****************************************************************************/
55 class BDI_DECLSPEC_diguy diguyIGuyController
56 {
57 
58 public:
59 
60 /*****************************************************************************/
66  /*l
67  *b Description:
68  **
69  ** This function sets the interactive character (I-Guy).
70  **
71  ** The I-Guy character's actions, position, and orientation
72  ** can be 'driven' by input from the mouse, keyboard, or
73  ** a joystick.
74  **
75  ** There can be at most one I-Guy at a time.
76  **
77  *b Arguments:
78  **
79  *a name - name of character to become I-Guy
80  *a initial_posture - this argument is not currently used,
81  *a but will be implemented in a future
82  *a version of DI-Guy
83  *a initial_variant - the initial motion variant the
84  *a I-Guy character should assume
85  **
86  ** Passing DIGUY_MOTION_VARIANT_ANY as the initial
87  ** variant will cause DI-Guy to select a default initial
88  ** variant. Passing DIGUY_MOTION_VARIANT_NORMAL will
89  ** cause the character to start in a non-aiming action.
90  ** Passing DIGUY_MOTION_VARIANT_AIM will cause the
91  ** character to start in an aiming action, if available.
92  ** Other variants will be supported in a future version.
93  **
94  *b Callable From:
95  **
96  *- - C++
97  *- - Script
98  */
99  void set_iguy_character(const char* name,
101  diguyMotionVariant initial_variant = DIGUY_MOTION_VARIANT_ANY);
102 
103  /*l
104  *b Returns:
105  **
106  ** pointer of type diguyCharacter* to the current I-Guy character
107  **
108  *b Callable From:
109  **
110  *- - C++
111  *- - Script
112  */
113  diguyCharacter* get_iguy_character();
114 
115 
116 /*****************************************************************************/
122  /*l
123  *b Description:
124  **
125  ** This function returns the character clicked on when in I-Guy
126  ** Input Mode. The pointer is valid during
127  ** CALLBACK_ID_IGUY_INTERACT_WITH_SUBJECT callbacks.
128  **
129  *b Returns:
130  **
131  ** pointer to type diguyCharacter; NULL if there is no interaction
132  ** subject
133  **
134  *b Callable From:
135  **
136  *- - C++
137  *- - Script
138  */
139  diguyCharacter* get_interaction_subject();
140 
141 
142 
143 /*****************************************************************************/
149  /*l
150  *b Description:
151  **
152  ** This function sets whether the I-Guy controller should update
153  ** the primary view's camera to keep the I-Guy in view.
154  **
155  *b Arguments:
156  **
157  *a enabled - pass 1 to enable camera changes, 0 to disable
158  **
159  *b Callable From:
160  **
161  *- - C++
162  *- - Script
163  */
164  void set_camera_change_enabled(int enabled);
165 
166  /*l
167  *b Returns:
168  **
169  ** 1 if I-Guy affects camera, 0 if not
170  **
171  *b Callable From:
172  **
173  *- - C++
174  *- - Script
175  */
176  int get_camera_change_enabled();
177 
178  /*l
179  *b Description:
180  **
181  ** This function sets whether the I-Guy controlled camera should be
182  ** 1st person (from-the-eyes view), or 3rd person (over the shoulder).
183  **
184  *b Arguments:
185  **
186  *a flag - pass 1 for 1st person, 0 for 3rd
187  **
188  *b Callable From:
189  **
190  *- - C++
191  *- - Script
192  */
193  void set_camera_use_1st_person_flag(int flag);
194 
195  /*l
196  *b Returns:
197  **
198  ** 1 if I-Guy controlled camera is 1st person, 0 if 3rd
199  **
200  *b Callable From:
201  **
202  *- - C++
203  *- - Script
204  */
205  int get_camera_use_1st_person_flag();
206 
207  /*l
208  *b Description:
209  **
210  ** This function sets which link the I-Guy controlled camera will
211  ** be attached to. For human characters, the best link is typically
212  ** "cervical" (the neck), or NULL (to use the base position of the
213  ** character). The default is "cervical".
214  **
215  ** This setting affects both 1st person and 3rd person cameras.
216  **
217  *b Arguments:
218  **
219  *a attachment_link - name of the link to attach to
220  **
221  ** Pass NULL to have the camera be attached to the I-Guy character's
222  ** base position.
223  **
224  *b Callable From:
225  **
226  *- - C++
227  *- - Script
228  */
229  void set_camera_attachment_link(const char* attachment_link);
230 
231  /*l
232  *b Returns:
233  **
234  ** the name of the current camera attachment link, or the empty
235  ** string ("") if there is none
236  **
237  *b Callable From:
238  **
239  *- - C++
240  *- - Script
241  */
242  const char* get_camera_attachment_link();
243 
244  /*l
245  *b Description:
246  **
247  ** This function sets the offset that is used from the attachment
248  ** link's position for the 3rd person camera's position.
249  **
250  ** Typically this has a slightly negative x value, to move the
251  ** camera behind the I-Guy character, and a positive z value, to
252  ** move the camera up so it can see over the character's head.
253  **
254  ** The default is x=-2.0, y=0.0f, z=0.35.
255  **
256  ** This setting affects only 3rd person cameras.
257  **
258  *b Arguments:
259  **
260  *a x, y, z - offset of camera position from attachment link
261  **
262  *b Callable From:
263  **
264  *- - C++
265  *- - Script
266  */
267  void set_camera_3rd_person_look_from_offset(float x, float y, float z);
268 
269  /*l
270  *b Description:
271  **
272  ** This function retrieves the offset that is used from the
273  ** attachment link's position for the 3rd person camera's position.
274  ** The offset values should be put into the variables pointed to.
275  **
276  *b Arguments:
277  **
278  *a x, y, z - pointers to variables in which offset should be
279  *a returned
280  **
281  *b Callable From:
282  **
283  *- - C++
284  *- - Script
285  */
286  void get_camera_3rd_person_look_from_offset(float* x, float* y, float* z);
287 
288  /*l
289  *b Description:
290  **
291  ** This function is similar to
292  ** set_camera_3rd_person_look_from_offset(), but affects the look-at
293  ** point instead.
294  **
295  ** The default is x=0.0, y=0.0, z=0.3.
296  **
297  *b Arguments:
298  **
299  *a x, y, z - offset of camera look-at point from attachment link
300  **
301  *b Callable From:
302  **
303  *- - C++
304  *- - Script
305  */
306  void set_camera_3rd_person_look_at_offset(float x, float y, float z);
307 
308  /*l
309  *b Description:
310  **
311  ** This function is similar to
312  ** get_camera_3rd_person_look_from_offset(), but affects the look-at
313  ** point instead.
314  **
315  *b Arguments:
316  **
317  *a x, y, z - pointers to variables in which offset should be
318  *a returned
319  **
320  *b Callable From:
321  **
322  *- - C++
323  *- - Script
324  */
325  void get_camera_3rd_person_look_at_offset(float* x, float* y, float* z);
326 
327 
328 /*****************************************************************************/
334  /*l
335  *b Description:
336  **
337  ** This function sets whether mouse input will affect the I-Guy
338  ** character.
339  **
340  *b Arguments:
341  **
342  *a enabled - pass 1 to enable mouse input, 0 to disable
343  **
344  *b Callable From:
345  **
346  *- - C++
347  *- - Script
348  */
349  void set_mouse_input_enabled(int enabled);
350 
351  /*l
352  *b Returns:
353  **
354  ** 1 if mouse input is enabled, 0 if not
355  **
356  *b Callable From:
357  **
358  *- - C++
359  *- - Script
360  */
361  int get_mouse_input_enabled();
362 
363  /*l
364  *b Description:
365  **
366  ** This function sets whether mouse input should be "captured".
367  **
368  ** A captured mouse's cursor doesn't move, but stays in the middle of
369  ** the view. This mode is common in first-person shooter (FPS) style
370  ** games.
371  **
372  ** A non-captured mouse's cursor is free to move anywhere on the
373  ** screen.
374  **
375  ** The setting only has an effect in DI-Guy Scenario.
376  **
377  *b Arguments:
378  **
379  *a enabled - pass 1 to enable input capture, 0 to disable
380  **
381  *b Callable From:
382  **
383  *- - C++
384  *- - Script
385  */
386  void set_input_capture_enabled(int enabled);
387 
388  /*l
389  *b Returns:
390  **
391  ** 1 if input is captured, 0 if not
392  **
393  *b Callable From:
394  **
395  *- - C++
396  *- - Script
397  */
398  int get_input_capture_enabled();
399 
400 
401 /*****************************************************************************/
407  /*l
408  *b Description:
409  **
410  ** This function sets whether keyboard input will affect the I-Guy
411  ** character.
412  **
413  *b Arguments:
414  **
415  *a enabled - pass 1 to enable keyboard input, 0 to disable
416  **
417  *b Callable From:
418  **
419  *- - C++
420  *- - Script
421  */
422  void set_keyboard_input_enabled(int enabled);
423 
424  /*l
425  *b Returns:
426  **
427  ** 1 if keyboard input is enabled, 0 if not
428  **
429  *b Callable From:
430  **
431  *- - C++
432  *- - Script
433  */
434  int get_keyboard_input_enabled();
435 
436 
437 /*****************************************************************************/
443  /*l
444  *b Description:
445  **
446  ** This function sets whether joystick input will affect the I-Guy
447  ** character.
448  **
449  *b Arguments:
450  **
451  *a enabled - pass 1 to enable joystick input, 0 to disable
452  **
453  *b Callable From:
454  **
455  *- - C++
456  *- - Script
457  */
458  void set_joystick_input_enabled(int enabled);
459 
460  /*l
461  *b Returns:
462  **
463  ** 1 if joystick input is enabled, 0 if not
464  **
465  *b Callable From:
466  **
467  *- - C++
468  *- - Script
469  */
470  int get_joystick_input_enabled();
471 
472 
473 /*****************************************************************************/
480  /*l
481  *b Description:
482  **
483  ** This function sets whether the I-Guy controller can affect the
484  ** posture of the character.
485  **
486  ** The default is 1, posture change enabled.
487  **
488  *b Arguments:
489  **
490  *a enabled - pass 1 to enable posture changes, 0 to disable
491  **
492  *b Callable From:
493  **
494  *- - C++
495  *- - Script
496  */
497  void set_posture_change_enabled(int enabled);
498 
499  /*l
500  *b Returns:
501  **
502  ** 1 if posture changes enabled, 0 if not
503  **
504  *b Callable From:
505  **
506  *- - C++
507  *- - Script
508  */
509  int get_posture_change_enabled();
510 
511  /*l
512  *b Description:
513  **
514  ** This function sets the desired posture of the I-Guy character.
515  **
516  ** Note that the character may not be able to maintain this posture.
517  ** For example, if the desired posture is prone but the character type
518  ** has no moving prone actions, a crouched action may be used for
519  ** moving instead.
520  **
521  ** This function will have no effect if posture changes are disabled,
522  ** as set by set_posture_change_enabled().
523  **
524  *b Arguments:
525  **
526  *a posture - desired posture
527  **
528  *b Callable From:
529  **
530  *- - C++
531  *- - Script
532  */
533  void set_posture(diguyMotionPosture posture);
534 
535  /*l
536  *b Returns:
537  **
538  ** the desired posture of the I-Guy character
539  **
540  *b Callable From:
541  **
542  *- - C++
543  *- - Script
544  */
545  diguyMotionPosture get_posture();
546 
547  /*l
548  *b Description:
549  **
550  ** This function sets whether the I-Guy controller can affect the
551  ** variant of the character.
552  **
553  ** The default is 1, variant change enabled.
554  **
555  *b Arguments:
556  **
557  *a enabled - pass 1 to enable variant changes, 0 to disable
558  **
559  *b Callable From:
560  **
561  *- - C++
562  *- - Script
563  */
564  void set_variant_change_enabled(int enabled);
565 
566  /*l
567  *b Returns:
568  **
569  ** 1 if variant changes enabled, 0 if not
570  **
571  *b Callable From:
572  **
573  *- - C++
574  *- - Script
575  */
576  int get_variant_change_enabled();
577 
578  /*l
579  *b Description:
580  **
581  ** This function sets the desired variant of the I-Guy character.
582  **
583  ** This function will have no effect if variant changes are disabled,
584  ** as set by set_variant_change_enabled().
585  **
586  ** Most often the variant of an I-Guy character should be one of:
587  **
588  *- - DIGUY_MOTION_VARIANT_NORMAL
589  *- - DIGUY_MOTION_VARIANT_AIM
590  **
591  *b Arguments:
592  **
593  *a variant - desired variant
594  **
595  *b Callable From:
596  **
597  *- - C++
598  *- - Script
599  */
600  void set_variant(diguyMotionVariant variant);
601 
602  /*l
603  *b Returns:
604  **
605  ** the desired variant of the I-Guy character
606  **
607  *b Callable From:
608  **
609  *- - C++
610  *- - Script
611  */
612  diguyMotionVariant get_variant();
613 
614 
615 /*****************************************************************************/
621  /*l
622  *b Description:
623  **
624  ** This function sets whether the I-Guy controller can affect the gaze
625  ** state of the character.
626  **
627  ** The default is 1, gaze change enabled.
628  **
629  *b Arguments:
630  **
631  *a enabled - pass 1 to enable gaze changes, 0 to disable
632  **
633  *b Callable From:
634  **
635  *- - C++
636  *- - Script
637  */
638  void set_gaze_change_enabled(int enabled);
639 
640  /*l
641  *b Returns:
642  **
643  ** 1 if gaze changes enabled, 0 if not
644  **
645  *b Callable From:
646  **
647  *- - C++
648  *- - Script
649  */
650  int get_gaze_change_enabled();
651 
652  /*l
653  *b Description:
654  **
655  ** This function sets whether the I-Guy controller can affect the
656  ** orientation of the character.
657  **
658  ** The default is 1, orientation change enabled.
659  **
660  *b Arguments:
661  **
662  *a enabled - pass 1 to enable orientation changes, 0 to disable
663  **
664  *b Callable From:
665  **
666  *- - C++
667  *- - Script
668  */
669  void set_orientation_change_enabled(int enabled);
670 
671  /*l
672  *b Returns:
673  **
674  ** 1 if gaze orientation enabled, 0 if not
675  **
676  *b Callable From:
677  **
678  *- - C++
679  *- - Script
680  */
681  int get_orientation_change_enabled();
682 
683  /*l
684  *b Description:
685  **
686  ** This function sets whether the I-Guy controller can affect the
687  ** position of the character.
688  **
689  ** The default is 1, position change enabled.
690  **
691  *b Arguments:
692  **
693  *a enabled - pass 1 to enable position changes, 0 to disable
694  **
695  *b Callable From:
696  **
697  *- - C++
698  *- - Script
699  */
700  void set_position_change_enabled(int enabled);
701 
702  /*l
703  *b Returns:
704  **
705  ** 1 if position changes enabled, 0 if not
706  **
707  *b Callable From:
708  **
709  *- - C++
710  *- - Script
711  */
712  int get_position_change_enabled();
713 
714 
715 /*****************************************************************************/
721  /*l
722  *b Description:
723  **
724  ** This function sets whether the I-Guy controller will change the
725  ** controlled character's action abruptly or allow action changes to
726  ** take place smoothly.
727  **
728  ** Forced action changes provide better responsiveness, but don't
729  ** look as nice.
730  **
731  ** See the functions diguyCharacter::force_action() and
732  ** diguyCharacter::set_desired_action().
733  **
734  ** The set_skip_transitions_flag() also has an effect on
735  ** responsiveness and how nice the action transitions look.
736  **
737  ** The default is 1, force actions.
738  **
739  *b Arguments:
740  **
741  *a use_force_action_flag - pass 1 to force quick action changes,
742  *a 0 to smooth action changes
743  **
744  *b Callable From:
745  **
746  *- - C++
747  *- - Script
748  */
749  void set_use_force_action_flag(int use_force_action_flag);
750 
751  /*l
752  *b Returns:
753  **
754  ** whether actions are forced (returns 1) or not (returns 0)
755  **
756  *b Callable From:
757  **
758  *- - C++
759  *- - Script
760  */
761  int get_use_force_action_flag();
762 
763  /*l
764  *b Description:
765  **
766  ** This function sets whether the I-Guy controller will, when new
767  ** actions are forced, the transition motions from the current
768  ** to the new action are skipped.
769  **
770  ** Skipping transitions provides better responsiveness, but doesn't
771  ** look as nice.
772  **
773  ** This setting only has an effect if the force action flag is set
774  ** to 1 (see set_use_force_action_flag()).
775  **
776  ** The default is 1, skip transitions.
777  **
778  *b Arguments:
779  **
780  *a skip_transitions_flag - pass 1 to skip transition motions,
781  *a 0 to play them
782  **
783  *b Callable From:
784  **
785  *- - C++
786  *- - Script
787  */
788  void set_skip_transitions_flag(int skip_transitions_flag);
789 
790  /*l
791  *b Returns:
792  **
793  ** whether transitions between actions are skipped (returns 1) or
794  ** not (returns 0)
795  **
796  *b Callable From:
797  **
798  *- - C++
799  *- - Script
800  */
801  int get_skip_transitions_flag();
802 
803 
804 /*****************************************************************************/
810  /*l
811  *b Description:
812  **
813  ** This function sets whether the I-Guy character will always try
814  ** to run, or move at its top speed.
815  **
816  ** The default is 0, don't always run.
817  **
818  *b Arguments:
819  **
820  *a always_run_flag - pass 1 to always run, 0 to be able to walk
821  *a and/or jog when moving slower
822  **
823  *b Callable From:
824  **
825  *- - C++
826  *- - Script
827  */
828  void set_always_run_flag(int always_run_flag);
829 
830  /*l
831  *b Returns:
832  **
833  ** whether the I-Guy character will always try to run (returns 1),
834  ** or not (returns 0)
835  **
836  *b Callable From:
837  **
838  *- - C++
839  *- - Script
840  */
841  int get_always_run_flag();
842 
843 
844 /*****************************************************************************/
850  /*l
851  *b Description:
852  **
853  ** This function returns the current azimiuth (left/right) facing
854  ** angle of the I-Guy character. This value will change as the
855  ** character is moved around by the I-Guy controller.
856  **
857  *b Returns:
858  **
859  ** current rz facing angle, in degrees
860  **
861  *b Callable From:
862  **
863  *- - C++
864  *- - Script
865  */
866  float get_face_rz();
867 
868  /*l
869  *b Description:
870  **
871  ** This function returns the current elevation (down/up) facing
872  ** angle of the I-Guy character. This value will change as the
873  ** character is moved around by the I-Guy controller.
874  **
875  *b Returns:
876  **
877  ** current ry facing angle, in degrees
878  **
879  *b Callable From:
880  **
881  *- - C++
882  *- - Script
883  */
884  float get_face_ry();
885 
886  /*l
887  *b Description:
888  **
889  ** This function sets the desired azimiuth (left/right) facing
890  ** angle of the I-Guy character.
891  **
892  ** Most often this value is changed via mouse, keyboard, or joystick
893  ** input, not by this function.
894  **
895  *b Callable From:
896  **
897  *- - C++
898  *- - Script
899  */
900  void set_face_rz_desired(float face_rz_desired);
901 
902  /*l
903  *b Returns:
904  **
905  ** desired rz facing angle, in degrees
906  **
907  *b Callable From:
908  **
909  *- - C++
910  *- - Script
911  */
912  float get_face_rz_desired();
913 
914  /*l
915  *b Description:
916  **
917  ** This function sets the desired elevation (down/up) facing
918  ** angle of the I-Guy character.
919  **
920  ** Most often this value is changed via mouse, keyboard, or joystick
921  ** input, not by this function.
922  **
923  *b Callable From:
924  **
925  *- - C++
926  *- - Script
927  */
928  void set_face_ry_desired(float face_ry_desired);
929 
930  /*l
931  *b Returns:
932  **
933  ** desired ry facing angle, in degrees
934  **
935  *b Callable From:
936  **
937  *- - C++
938  *- - Script
939  */
940  float get_face_ry_desired();
941 
942  /*l
943  *b Description:
944  **
945  ** This function sets the desired rz and ry facing angles of the
946  ** I-Guy controlled character toward the specified character.
947  **
948  *b Callable From:
949  **
950  *- - C++
951  *- - Script
952  */
953  void face_character(const char* character_name,
954  const char* link,
955  float offset_rz = 0.0f,
956  float offset_ry = 0.0f);
957 
958 
959 /****************************************************************************/
960 /****************************************************************************/
971 /****************************************************************************/
972 /****************************************************************************/
973 
974  /*l
975  ** Deprecated; use set_orientation_change_enabled() instead.
976  */
977  void set_mouse_look_changes_orientation(int val);
978 
979  /*l
980  ** Deprecated; use get_orientation_change_enabled() instead.
981  */
982  int get_mouse_look_changes_orientation();
983 
984 
989 #ifdef CPLUSPLUS_ONLY
990 
991  bdiScenarioIGuy* get_scripted_object() {return m_scripted_object;}
992 
993 private:
994 
995  /*l
996  ** A private constructor.
997  */
998  diguyIGuyController(bdiScenarioIGuy* iguy);
999 
1000  /*l
1001  ** A pointer to internal data.
1002  */
1003  bdiScenarioIGuy* m_scripted_object;
1004 
1005  friend class bdiScenarioIGuy;
1006 
1007 #endif
1008 
1009 };
1010 
1011 #endif /* __diguyIGuyController_H */
1012