PhysicsEvents2D.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //
  2. // Copyright (c) 2008-2020 the Urho3D project.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include "../Core/Object.h"
  24. // For prestep / poststep events, which are the same for 2D and 3D physics. The events themselves don't depend
  25. // on whether 3D physics support or Bullet has been compiled in.
  26. #include "../Physics/PhysicsEvents.h"
  27. namespace Urho3D
  28. {
  29. /// Physics update contact. Global event sent by PhysicsWorld2D.
  30. URHO3D_EVENT(E_PHYSICSUPDATECONTACT2D, PhysicsUpdateContact2D)
  31. {
  32. URHO3D_PARAM(P_WORLD, World); // PhysicsWorld2D pointer
  33. URHO3D_PARAM(P_BODYA, BodyA); // RigidBody2D pointer
  34. URHO3D_PARAM(P_BODYB, BodyB); // RigidBody2D pointer
  35. URHO3D_PARAM(P_NODEA, NodeA); // Node pointer
  36. URHO3D_PARAM(P_NODEB, NodeB); // Node pointer
  37. URHO3D_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
  38. URHO3D_PARAM(P_SHAPEA, ShapeA); // CollisionShape2D pointer
  39. URHO3D_PARAM(P_SHAPEB, ShapeB); // CollisionShape2D pointer
  40. URHO3D_PARAM(P_ENABLED, Enabled); // bool [in/out]
  41. }
  42. /// Physics begin contact. Global event sent by PhysicsWorld2D.
  43. URHO3D_EVENT(E_PHYSICSBEGINCONTACT2D, PhysicsBeginContact2D)
  44. {
  45. URHO3D_PARAM(P_WORLD, World); // PhysicsWorld2D pointer
  46. URHO3D_PARAM(P_BODYA, BodyA); // RigidBody2D pointer
  47. URHO3D_PARAM(P_BODYB, BodyB); // RigidBody2D pointer
  48. URHO3D_PARAM(P_NODEA, NodeA); // Node pointer
  49. URHO3D_PARAM(P_NODEB, NodeB); // Node pointer
  50. URHO3D_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
  51. URHO3D_PARAM(P_SHAPEA, ShapeA); // CollisionShape2D pointer
  52. URHO3D_PARAM(P_SHAPEB, ShapeB); // CollisionShape2D pointer
  53. }
  54. /// Physics end contact. Global event sent by PhysicsWorld2D.
  55. URHO3D_EVENT(E_PHYSICSENDCONTACT2D, PhysicsEndContact2D)
  56. {
  57. URHO3D_PARAM(P_WORLD, World); // PhysicsWorld2D pointer
  58. URHO3D_PARAM(P_BODYA, BodyA); // RigidBody2D pointer
  59. URHO3D_PARAM(P_BODYB, BodyB); // RigidBody2D pointer
  60. URHO3D_PARAM(P_NODEA, NodeA); // Node pointer
  61. URHO3D_PARAM(P_NODEB, NodeB); // Node pointer
  62. URHO3D_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
  63. URHO3D_PARAM(P_SHAPEA, ShapeA); // CollisionShape2D pointer
  64. URHO3D_PARAM(P_SHAPEB, ShapeB); // CollisionShape2D pointer
  65. }
  66. /// Node update contact. Sent by scene nodes participating in a collision.
  67. URHO3D_EVENT(E_NODEUPDATECONTACT2D, NodeUpdateContact2D)
  68. {
  69. URHO3D_PARAM(P_BODY, Body); // RigidBody2D pointer
  70. URHO3D_PARAM(P_OTHERNODE, OtherNode); // Node pointer
  71. URHO3D_PARAM(P_OTHERBODY, OtherBody); // RigidBody2D pointer
  72. URHO3D_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
  73. URHO3D_PARAM(P_SHAPE, Shape); // CollisionShape2D pointer
  74. URHO3D_PARAM(P_OTHERSHAPE, OtherShape); // CollisionShape2D pointer
  75. URHO3D_PARAM(P_ENABLED, Enabled); // bool [in/out]
  76. }
  77. /// Node begin contact. Sent by scene nodes participating in a collision.
  78. URHO3D_EVENT(E_NODEBEGINCONTACT2D, NodeBeginContact2D)
  79. {
  80. URHO3D_PARAM(P_BODY, Body); // RigidBody2D pointer
  81. URHO3D_PARAM(P_OTHERNODE, OtherNode); // Node pointer
  82. URHO3D_PARAM(P_OTHERBODY, OtherBody); // RigidBody2D pointer
  83. URHO3D_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
  84. URHO3D_PARAM(P_SHAPE, Shape); // CollisionShape2D pointer
  85. URHO3D_PARAM(P_OTHERSHAPE, OtherShape); // CollisionShape2D pointer
  86. }
  87. /// Node end contact. Sent by scene nodes participating in a collision.
  88. URHO3D_EVENT(E_NODEENDCONTACT2D, NodeEndContact2D)
  89. {
  90. URHO3D_PARAM(P_BODY, Body); // RigidBody2D pointer
  91. URHO3D_PARAM(P_OTHERNODE, OtherNode); // Node pointer
  92. URHO3D_PARAM(P_OTHERBODY, OtherBody); // RigidBody2D pointer
  93. URHO3D_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
  94. URHO3D_PARAM(P_SHAPE, Shape); // CollisionShape2D pointer
  95. URHO3D_PARAM(P_OTHERSHAPE, OtherShape); // CollisionShape2D pointer
  96. }
  97. }