PhysicsEvents.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. namespace Atomic
  25. {
  26. /// Physics world is about to be stepped.
  27. ATOMIC_EVENT(E_PHYSICSPRESTEP, PhysicsPreStep)
  28. {
  29. ATOMIC_PARAM(P_WORLD, World); // PhysicsWorld pointer
  30. ATOMIC_PARAM(P_TIMESTEP, TimeStep); // float
  31. }
  32. /// Physics world has been stepped.
  33. ATOMIC_EVENT(E_PHYSICSPOSTSTEP, PhysicsPostStep)
  34. {
  35. ATOMIC_PARAM(P_WORLD, World); // PhysicsWorld pointer
  36. ATOMIC_PARAM(P_TIMESTEP, TimeStep); // float
  37. }
  38. /// Physics collision started. Global event sent by the PhysicsWorld.
  39. ATOMIC_EVENT(E_PHYSICSCOLLISIONSTART, PhysicsCollisionStart)
  40. {
  41. ATOMIC_PARAM(P_WORLD, World); // PhysicsWorld pointer
  42. ATOMIC_PARAM(P_NODEA, NodeA); // Node pointer
  43. ATOMIC_PARAM(P_NODEB, NodeB); // Node pointer
  44. ATOMIC_PARAM(P_BODYA, BodyA); // RigidBody pointer
  45. ATOMIC_PARAM(P_BODYB, BodyB); // RigidBody pointer
  46. ATOMIC_PARAM(P_TRIGGER, Trigger); // bool
  47. ATOMIC_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector3), normal (Vector3), distance (float), impulse (float) for each contact
  48. }
  49. /// Physics collision ongoing. Global event sent by the PhysicsWorld.
  50. ATOMIC_EVENT(E_PHYSICSCOLLISION, PhysicsCollision)
  51. {
  52. ATOMIC_PARAM(P_WORLD, World); // PhysicsWorld pointer
  53. ATOMIC_PARAM(P_NODEA, NodeA); // Node pointer
  54. ATOMIC_PARAM(P_NODEB, NodeB); // Node pointer
  55. ATOMIC_PARAM(P_BODYA, BodyA); // RigidBody pointer
  56. ATOMIC_PARAM(P_BODYB, BodyB); // RigidBody pointer
  57. ATOMIC_PARAM(P_TRIGGER, Trigger); // bool
  58. ATOMIC_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector3), normal (Vector3), distance (float), impulse (float) for each contact
  59. }
  60. /// Physics collision ended. Global event sent by the PhysicsWorld.
  61. ATOMIC_EVENT(E_PHYSICSCOLLISIONEND, PhysicsCollisionEnd)
  62. {
  63. ATOMIC_PARAM(P_WORLD, World); // PhysicsWorld pointer
  64. ATOMIC_PARAM(P_NODEA, NodeA); // Node pointer
  65. ATOMIC_PARAM(P_NODEB, NodeB); // Node pointer
  66. ATOMIC_PARAM(P_BODYA, BodyA); // RigidBody pointer
  67. ATOMIC_PARAM(P_BODYB, BodyB); // RigidBody pointer
  68. ATOMIC_PARAM(P_TRIGGER, Trigger); // bool
  69. }
  70. /// Node's physics collision started. Sent by scene nodes participating in a collision.
  71. ATOMIC_EVENT(E_NODECOLLISIONSTART, NodeCollisionStart)
  72. {
  73. ATOMIC_PARAM(P_BODY, Body); // RigidBody pointer
  74. ATOMIC_PARAM(P_OTHERNODE, OtherNode); // Node pointer
  75. ATOMIC_PARAM(P_OTHERBODY, OtherBody); // RigidBody pointer
  76. ATOMIC_PARAM(P_TRIGGER, Trigger); // bool
  77. ATOMIC_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector3), normal (Vector3), distance (float), impulse (float) for each contact
  78. }
  79. /// Node's physics collision ongoing. Sent by scene nodes participating in a collision.
  80. ATOMIC_EVENT(E_NODECOLLISION, NodeCollision)
  81. {
  82. ATOMIC_PARAM(P_BODY, Body); // RigidBody pointer
  83. ATOMIC_PARAM(P_OTHERNODE, OtherNode); // Node pointer
  84. ATOMIC_PARAM(P_OTHERBODY, OtherBody); // RigidBody pointer
  85. ATOMIC_PARAM(P_TRIGGER, Trigger); // bool
  86. ATOMIC_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector3), normal (Vector3), distance (float), impulse (float) for each contact
  87. }
  88. /// Node's physics collision ended. Sent by scene nodes participating in a collision.
  89. ATOMIC_EVENT(E_NODECOLLISIONEND, NodeCollisionEnd)
  90. {
  91. ATOMIC_PARAM(P_BODY, Body); // RigidBody pointer
  92. ATOMIC_PARAM(P_OTHERNODE, OtherNode); // Node pointer
  93. ATOMIC_PARAM(P_OTHERBODY, OtherBody); // RigidBody pointer
  94. ATOMIC_PARAM(P_TRIGGER, Trigger); // bool
  95. }
  96. }