body_shape.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*************************************************************************/
  2. /* body_shape.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* http://www.godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
  9. /* */
  10. /* Permission is hereby granted, free of charge, to any person obtaining */
  11. /* a copy of this software and associated documentation files (the */
  12. /* "Software"), to deal in the Software without restriction, including */
  13. /* without limitation the rights to use, copy, modify, merge, publish, */
  14. /* distribute, sublicense, and/or sell copies of the Software, and to */
  15. /* permit persons to whom the Software is furnished to do so, subject to */
  16. /* the following conditions: */
  17. /* */
  18. /* The above copyright notice and this permission notice shall be */
  19. /* included in all copies or substantial portions of the Software. */
  20. /* */
  21. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  22. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  23. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  24. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  25. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  26. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  27. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  28. /*************************************************************************/
  29. #ifndef COLLISION_SHAPE_H
  30. #define COLLISION_SHAPE_H
  31. #include "scene/3d/spatial.h"
  32. #include "scene/resources/shape.h"
  33. class CollisionShape : public Spatial {
  34. OBJ_TYPE( CollisionShape, Spatial );
  35. OBJ_CATEGORY("3D Physics Nodes");
  36. Ref<Shape> shape;
  37. /*
  38. RID _get_visual_instance_rid() const;
  39. void _update_indicator();
  40. RID material;
  41. RID indicator;
  42. RID indicator_instance;
  43. */
  44. Node* debug_shape;
  45. void resource_changed(RES res);
  46. bool updating_body;
  47. bool unparenting;
  48. bool trigger;
  49. bool can_update_body;
  50. int update_shape_index;
  51. void _update_body();
  52. void _add_to_collision_object(Object* p_cshape);
  53. void _set_update_shape_index(int p_index);
  54. int _get_update_shape_index() const;
  55. void _create_debug_shape();
  56. protected:
  57. void _notification(int p_what);
  58. static void _bind_methods();
  59. public:
  60. void make_convex_from_brothers();
  61. void set_shape(const Ref<Shape> &p_shape);
  62. Ref<Shape> get_shape() const;
  63. void set_updating_body(bool p_update);
  64. bool is_updating_body() const;
  65. void set_trigger(bool p_trigger);
  66. bool is_trigger() const;
  67. int get_collision_object_shape_index() const { return _get_update_shape_index(); }
  68. CollisionShape();
  69. ~CollisionShape();
  70. };
  71. #endif // BODY_VOLUME_H