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 
23 #pragma once
24 
25 #include "../Core/Object.h"
26 
27 // For prestep / poststep events, which are the same for 2D and 3D physics. The events themselves don't depend
28 // on whether 3D physics support or Bullet has been compiled in.
29 #include "../Physics/PhysicsEvents.h"
30 
31 namespace Urho3D
32 {
33 
34 /// Physics update contact. Global event sent by PhysicsWorld2D.
URHO3D_EVENT(E_PHYSICSUPDATECONTACT2D,PhysicsUpdateContact2D)35 URHO3D_EVENT(E_PHYSICSUPDATECONTACT2D, PhysicsUpdateContact2D)
36 {
37     URHO3D_PARAM(P_WORLD, World);                  // PhysicsWorld2D pointer
38     URHO3D_PARAM(P_BODYA, BodyA);                  // RigidBody2D pointer
39     URHO3D_PARAM(P_BODYB, BodyB);                  // RigidBody2D pointer
40     URHO3D_PARAM(P_NODEA, NodeA);                  // Node pointer
41     URHO3D_PARAM(P_NODEB, NodeB);                  // Node pointer
42     URHO3D_PARAM(P_CONTACTS, Contacts);            // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
43     URHO3D_PARAM(P_SHAPEA, ShapeA);                // CollisionShape2D pointer
44     URHO3D_PARAM(P_SHAPEB, ShapeB);                // CollisionShape2D pointer
45     URHO3D_PARAM(P_ENABLED, Enabled);              // bool [in/out]
46 }
47 
48 /// Physics begin contact. Global event sent by PhysicsWorld2D.
URHO3D_EVENT(E_PHYSICSBEGINCONTACT2D,PhysicsBeginContact2D)49 URHO3D_EVENT(E_PHYSICSBEGINCONTACT2D, PhysicsBeginContact2D)
50 {
51     URHO3D_PARAM(P_WORLD, World);                  // PhysicsWorld2D pointer
52     URHO3D_PARAM(P_BODYA, BodyA);                  // RigidBody2D pointer
53     URHO3D_PARAM(P_BODYB, BodyB);                  // RigidBody2D pointer
54     URHO3D_PARAM(P_NODEA, NodeA);                  // Node pointer
55     URHO3D_PARAM(P_NODEB, NodeB);                  // Node pointer
56     URHO3D_PARAM(P_CONTACTS, Contacts);            // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
57     URHO3D_PARAM(P_SHAPEA, ShapeA);                // CollisionShape2D pointer
58     URHO3D_PARAM(P_SHAPEB, ShapeB);                // CollisionShape2D pointer
59 }
60 
61 /// Physics end contact. Global event sent by PhysicsWorld2D.
URHO3D_EVENT(E_PHYSICSENDCONTACT2D,PhysicsEndContact2D)62 URHO3D_EVENT(E_PHYSICSENDCONTACT2D, PhysicsEndContact2D)
63 {
64     URHO3D_PARAM(P_WORLD, World);                  // PhysicsWorld2D pointer
65     URHO3D_PARAM(P_BODYA, BodyA);                  // RigidBody2D pointer
66     URHO3D_PARAM(P_BODYB, BodyB);                  // RigidBody2D pointer
67     URHO3D_PARAM(P_NODEA, NodeA);                  // Node pointer
68     URHO3D_PARAM(P_NODEB, NodeB);                  // Node pointer
69     URHO3D_PARAM(P_CONTACTS, Contacts);            // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
70     URHO3D_PARAM(P_SHAPEA, ShapeA);                // CollisionShape2D pointer
71     URHO3D_PARAM(P_SHAPEB, ShapeB);                // CollisionShape2D pointer
72 }
73 
74 /// Node update contact. Sent by scene nodes participating in a collision.
URHO3D_EVENT(E_NODEUPDATECONTACT2D,NodeUpdateContact2D)75 URHO3D_EVENT(E_NODEUPDATECONTACT2D, NodeUpdateContact2D)
76 {
77     URHO3D_PARAM(P_BODY, Body);                    // RigidBody2D pointer
78     URHO3D_PARAM(P_OTHERNODE, OtherNode);          // Node pointer
79     URHO3D_PARAM(P_OTHERBODY, OtherBody);          // RigidBody2D pointer
80     URHO3D_PARAM(P_CONTACTS, Contacts);            // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
81     URHO3D_PARAM(P_SHAPE, Shape);                  // CollisionShape2D pointer
82     URHO3D_PARAM(P_OTHERSHAPE, OtherShape);        // CollisionShape2D pointer
83     URHO3D_PARAM(P_ENABLED, Enabled);              // bool [in/out]
84 }
85 
86 /// Node begin contact. Sent by scene nodes participating in a collision.
URHO3D_EVENT(E_NODEBEGINCONTACT2D,NodeBeginContact2D)87 URHO3D_EVENT(E_NODEBEGINCONTACT2D, NodeBeginContact2D)
88 {
89     URHO3D_PARAM(P_BODY, Body);                    // RigidBody2D pointer
90     URHO3D_PARAM(P_OTHERNODE, OtherNode);          // Node pointer
91     URHO3D_PARAM(P_OTHERBODY, OtherBody);          // RigidBody2D pointer
92     URHO3D_PARAM(P_CONTACTS, Contacts);            // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
93     URHO3D_PARAM(P_SHAPE, Shape);                  // CollisionShape2D pointer
94     URHO3D_PARAM(P_OTHERSHAPE, OtherShape);        // CollisionShape2D pointer
95 }
96 
97 /// Node end contact. Sent by scene nodes participating in a collision.
URHO3D_EVENT(E_NODEENDCONTACT2D,NodeEndContact2D)98 URHO3D_EVENT(E_NODEENDCONTACT2D, NodeEndContact2D)
99 {
100     URHO3D_PARAM(P_BODY, Body);                    // RigidBody2D pointer
101     URHO3D_PARAM(P_OTHERNODE, OtherNode);          // Node pointer
102     URHO3D_PARAM(P_OTHERBODY, OtherBody);          // RigidBody2D pointer
103     URHO3D_PARAM(P_CONTACTS, Contacts);            // Buffer containing position (Vector2), normal (Vector2), negative overlap distance (float). Normal is the same for all points.
104     URHO3D_PARAM(P_SHAPE, Shape);                  // CollisionShape2D pointer
105     URHO3D_PARAM(P_OTHERSHAPE, OtherShape);        // CollisionShape2D pointer
106 }
107 
108 }
109