PhysicsEvents2D.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //
  2. // Copyright (c) 2008-2017 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 Atomic
  28. {
  29. /// Physics update contact. Global event sent by PhysicsWorld2D.
  30. ATOMIC_EVENT(E_PHYSICSUPDATECONTACT2D, PhysicsUpdateContact2D)
  31. {
  32. ATOMIC_PARAM(P_WORLD, World); // PhysicsWorld2D pointer
  33. ATOMIC_PARAM(P_BODYA, BodyA); // RigidBody2D pointer
  34. ATOMIC_PARAM(P_BODYB, BodyB); // RigidBody2D pointer
  35. ATOMIC_PARAM(P_NODEA, NodeA); // Node pointer
  36. ATOMIC_PARAM(P_NODEB, NodeB); // Node pointer
  37. ATOMIC_PARAM(P_CONTACT, Contact); // b2Contact pointer
  38. ATOMIC_PARAM(P_CONTACTPOINTS, ContactPoints); // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
  39. ATOMIC_PARAM(P_SHAPEA, ShapeA); // CollisionShape2D pointer
  40. ATOMIC_PARAM(P_SHAPEB, ShapeB); // CollisionShape2D pointer
  41. ATOMIC_PARAM(P_ENABLED, Enabled); // bool [in/out]
  42. }
  43. /// Physics begin contact. Global event sent by PhysicsWorld2D.
  44. ATOMIC_EVENT(E_PHYSICSBEGINCONTACT2D, PhysicsBeginContact2D)
  45. {
  46. ATOMIC_PARAM(P_WORLD, World); // PhysicsWorld2D pointer
  47. ATOMIC_PARAM(P_BODYA, BodyA); // RigidBody2D pointer
  48. ATOMIC_PARAM(P_BODYB, BodyB); // RigidBody2D pointer
  49. ATOMIC_PARAM(P_NODEA, NodeA); // Node pointer
  50. ATOMIC_PARAM(P_NODEB, NodeB); // Node pointer
  51. ATOMIC_PARAM(P_CONTACT, Contact); // b2Contact pointer
  52. ATOMIC_PARAM(P_CONTACTPOINTS, ContactPoints); // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
  53. ATOMIC_PARAM(P_SHAPEA, ShapeA); // CollisionShape2D pointer
  54. ATOMIC_PARAM(P_SHAPEB, ShapeB); // CollisionShape2D pointer
  55. }
  56. /// Physics end contact. Global event sent by PhysicsWorld2D.
  57. ATOMIC_EVENT(E_PHYSICSENDCONTACT2D, PhysicsEndContact2D)
  58. {
  59. ATOMIC_PARAM(P_WORLD, World); // PhysicsWorld2D pointer
  60. ATOMIC_PARAM(P_BODYA, BodyA); // RigidBody2D pointer
  61. ATOMIC_PARAM(P_BODYB, BodyB); // RigidBody2D pointer
  62. ATOMIC_PARAM(P_NODEA, NodeA); // Node pointer
  63. ATOMIC_PARAM(P_NODEB, NodeB); // Node pointer
  64. ATOMIC_PARAM(P_CONTACT, Contact); // b2Contact pointer
  65. ATOMIC_PARAM(P_CONTACTPOINTS, ContactPoints); // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
  66. ATOMIC_PARAM(P_SHAPEA, ShapeA); // CollisionShape2D pointer
  67. ATOMIC_PARAM(P_SHAPEB, ShapeB); // CollisionShape2D pointer
  68. }
  69. /// Node update contact. Sent by scene nodes participating in a collision.
  70. ATOMIC_EVENT(E_NODEUPDATECONTACT2D, NodeUpdateContact2D)
  71. {
  72. ATOMIC_PARAM(P_BODY, Body); // RigidBody2D pointer
  73. ATOMIC_PARAM(P_OTHERNODE, OtherNode); // Node pointer
  74. ATOMIC_PARAM(P_OTHERBODY, OtherBody); // RigidBody2D pointer
  75. ATOMIC_PARAM(P_CONTACT, Contact); // b2Contact pointer
  76. ATOMIC_PARAM(P_CONTACTPOINTS, ContactPoints); // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
  77. ATOMIC_PARAM(P_SHAPE, Shape); // CollisionShape2D pointer
  78. ATOMIC_PARAM(P_OTHERSHAPE, OtherShape); // CollisionShape2D pointer
  79. ATOMIC_PARAM(P_ENABLED, Enabled); // bool [in/out]
  80. }
  81. /// Node begin contact. Sent by scene nodes participating in a collision.
  82. ATOMIC_EVENT(E_NODEBEGINCONTACT2D, NodeBeginContact2D)
  83. {
  84. ATOMIC_PARAM(P_BODY, Body); // RigidBody2D pointer
  85. ATOMIC_PARAM(P_OTHERNODE, OtherNode); // Node pointer
  86. ATOMIC_PARAM(P_OTHERBODY, OtherBody); // RigidBody2D pointer
  87. ATOMIC_PARAM(P_CONTACT, Contact); // b2Contact pointer
  88. ATOMIC_PARAM(P_CONTACTPOINTS, ContactPoints); // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
  89. ATOMIC_PARAM(P_SHAPE, Shape); // CollisionShape2D pointer
  90. ATOMIC_PARAM(P_OTHERSHAPE, OtherShape); // CollisionShape2D pointer
  91. }
  92. /// Node end contact. Sent by scene nodes participating in a collision.
  93. ATOMIC_EVENT(E_NODEENDCONTACT2D, NodeEndContact2D)
  94. {
  95. ATOMIC_PARAM(P_BODY, Body); // RigidBody2D pointer
  96. ATOMIC_PARAM(P_OTHERNODE, OtherNode); // Node pointer
  97. ATOMIC_PARAM(P_OTHERBODY, OtherBody); // RigidBody2D pointer
  98. ATOMIC_PARAM(P_CONTACT, Contact); // b2Contact pointer
  99. ATOMIC_PARAM(P_CONTACTPOINTS, ContactPoints); // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
  100. ATOMIC_PARAM(P_SHAPE, Shape); // CollisionShape2D pointer
  101. ATOMIC_PARAM(P_OTHERSHAPE, OtherShape); // CollisionShape2D pointer
  102. }
  103. }