PhysicsEvents.h 4.7 KB

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