body_shape.h 3.4 KB

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