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