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