PhysicsEvents.h 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include "../Core/Object.h"
  5. namespace Urho3D
  6. {
  7. /// Physics world is about to be stepped.
  8. URHO3D_EVENT(E_PHYSICSPRESTEP, PhysicsPreStep)
  9. {
  10. URHO3D_PARAM(P_WORLD, World); // PhysicsWorld pointer
  11. URHO3D_PARAM(P_TIMESTEP, TimeStep); // float
  12. }
  13. /// Physics world has been stepped.
  14. URHO3D_EVENT(E_PHYSICSPOSTSTEP, PhysicsPostStep)
  15. {
  16. URHO3D_PARAM(P_WORLD, World); // PhysicsWorld pointer
  17. URHO3D_PARAM(P_TIMESTEP, TimeStep); // float
  18. }
  19. /// Physics collision started. Global event sent by the PhysicsWorld.
  20. URHO3D_EVENT(E_PHYSICSCOLLISIONSTART, PhysicsCollisionStart)
  21. {
  22. URHO3D_PARAM(P_WORLD, World); // PhysicsWorld pointer
  23. URHO3D_PARAM(P_NODEA, NodeA); // Node pointer
  24. URHO3D_PARAM(P_NODEB, NodeB); // Node pointer
  25. URHO3D_PARAM(P_BODYA, BodyA); // RigidBody pointer
  26. URHO3D_PARAM(P_BODYB, BodyB); // RigidBody pointer
  27. URHO3D_PARAM(P_TRIGGER, Trigger); // bool
  28. URHO3D_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector3), normal (Vector3), distance (float), impulse (float) for each contact
  29. }
  30. /// Physics collision ongoing. Global event sent by the PhysicsWorld.
  31. URHO3D_EVENT(E_PHYSICSCOLLISION, PhysicsCollision)
  32. {
  33. URHO3D_PARAM(P_WORLD, World); // PhysicsWorld pointer
  34. URHO3D_PARAM(P_NODEA, NodeA); // Node pointer
  35. URHO3D_PARAM(P_NODEB, NodeB); // Node pointer
  36. URHO3D_PARAM(P_BODYA, BodyA); // RigidBody pointer
  37. URHO3D_PARAM(P_BODYB, BodyB); // RigidBody pointer
  38. URHO3D_PARAM(P_TRIGGER, Trigger); // bool
  39. URHO3D_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector3), normal (Vector3), distance (float), impulse (float) for each contact
  40. }
  41. /// Physics collision ended. Global event sent by the PhysicsWorld.
  42. URHO3D_EVENT(E_PHYSICSCOLLISIONEND, PhysicsCollisionEnd)
  43. {
  44. URHO3D_PARAM(P_WORLD, World); // PhysicsWorld pointer
  45. URHO3D_PARAM(P_NODEA, NodeA); // Node pointer
  46. URHO3D_PARAM(P_NODEB, NodeB); // Node pointer
  47. URHO3D_PARAM(P_BODYA, BodyA); // RigidBody pointer
  48. URHO3D_PARAM(P_BODYB, BodyB); // RigidBody pointer
  49. URHO3D_PARAM(P_TRIGGER, Trigger); // bool
  50. }
  51. /// Node's physics collision started. Sent by scene nodes participating in a collision.
  52. URHO3D_EVENT(E_NODECOLLISIONSTART, NodeCollisionStart)
  53. {
  54. URHO3D_PARAM(P_BODY, Body); // RigidBody pointer
  55. URHO3D_PARAM(P_OTHERNODE, OtherNode); // Node pointer
  56. URHO3D_PARAM(P_OTHERBODY, OtherBody); // 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. /// Node's physics collision ongoing. Sent by scene nodes participating in a collision.
  61. URHO3D_EVENT(E_NODECOLLISION, NodeCollision)
  62. {
  63. URHO3D_PARAM(P_BODY, Body); // RigidBody pointer
  64. URHO3D_PARAM(P_OTHERNODE, OtherNode); // Node pointer
  65. URHO3D_PARAM(P_OTHERBODY, OtherBody); // RigidBody pointer
  66. URHO3D_PARAM(P_TRIGGER, Trigger); // bool
  67. URHO3D_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector3), normal (Vector3), distance (float), impulse (float) for each contact
  68. }
  69. /// Node's physics collision ended. Sent by scene nodes participating in a collision.
  70. URHO3D_EVENT(E_NODECOLLISIONEND, NodeCollisionEnd)
  71. {
  72. URHO3D_PARAM(P_BODY, Body); // RigidBody pointer
  73. URHO3D_PARAM(P_OTHERNODE, OtherNode); // Node pointer
  74. URHO3D_PARAM(P_OTHERBODY, OtherBody); // RigidBody pointer
  75. URHO3D_PARAM(P_TRIGGER, Trigger); // bool
  76. }
  77. }