Skip to content

Commit 860943e

Browse files
authored
chore: Update IContactEventHandler to reflect changes in Stride's #2901 PR (#423)
1 parent c7e75c5 commit 860943e

File tree

2 files changed

+9
-25
lines changed

2 files changed

+9
-25
lines changed

en/manual/physics/script-a-trigger.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ Let's write a script to change the size of the ball when it enters the trigger.
127127

128128
namespace TransformTrigger
129129
{
130-
// Adding IContactEventHandler to listen to contact events
131-
public class Trigger : SyncScript, IContactEventHandler
130+
// Adding IContactHandler to listen to contact events
131+
public class Trigger : SyncScript, IContactHandler
132132
{
133133
public override void Start()
134134
{
@@ -143,24 +143,16 @@ Let's write a script to change the size of the ball when it enters the trigger.
143143
// Let objects pass through this trigger, false would make objects bounce off it
144144
public bool NoContactResponse => true;
145145

146-
void IContactEventHandler.OnStartedTouching<TManifold>(CollidableComponent eventSource, CollidableComponent other,
147-
ref TManifold contactManifold,
148-
bool flippedManifold,
149-
int workerIndex,
150-
BepuSimulation bepuSimulation)
146+
void IContactHandler.OnStartedTouching<TManifold>(ContactData<TManifold> contactData)
151147
{
152148
// When something enters inside this object
153-
other.Entity.Transform.Scale = new Vector3(2.0f);
149+
contactData.Other.Entity.Transform.Scale = new Vector3(2.0f);
154150
}
155151

156-
void IContactEventHandler.OnStoppedTouching<TManifold>(CollidableComponent eventSource, CollidableComponent other,
157-
ref TManifold contactManifold,
158-
bool flippedManifold,
159-
int workerIndex,
160-
BepuSimulation bepuSimulation)
152+
void IContactHandler.OnStoppedTouching<TManifold>(ContactData<TManifold> contactData)
161153
{
162154
// When something exits this object
163-
other.Entity.Transform.Scale = new Vector3(1.0f);
155+
contactData.Other.Entity.Transform.Scale = new Vector3(1.0f);
164156
}
165157
}
166158
}

en/manual/physics/triggers.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,16 @@ using Stride.BepuPhysics;
1717
using Stride.BepuPhysics.Definitions.Contacts;
1818
using Stride.Engine;
1919

20-
public class Test : StartupScript, IContactEventHandler
20+
public class Test : StartupScript, IContactHandler
2121
{
2222
public bool NoContactResponse => true;
2323

24-
void IContactEventHandler.OnStartedTouching<TManifold>(CollidableComponent eventSource, CollidableComponent other,
25-
ref TManifold contactManifold,
26-
bool flippedManifold,
27-
int workerIndex,
28-
BepuSimulation bepuSimulation)
24+
void IContactHandler.OnStartedTouching<TManifold>(ContactData<TManifold> contactData)
2925
{
3026
Log.Warning("Entered!");
3127
}
3228

33-
void IContactEventHandler.OnStoppedTouching<TManifold>(CollidableComponent eventSource, CollidableComponent other,
34-
ref TManifold contactManifold,
35-
bool flippedManifold,
36-
int workerIndex,
37-
BepuSimulation bepuSimulation)
29+
void IContactHandler.OnStoppedTouching<TManifold>(ContactData<TManifold> contactData)
3830
{
3931
Log.Warning("Exited!");
4032
}

0 commit comments

Comments
 (0)