Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions en/manual/physics/script-a-trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ Let's write a script to change the size of the ball when it enters the trigger.

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

void IContactEventHandler.OnStartedTouching<TManifold>(CollidableComponent eventSource, CollidableComponent other,
ref TManifold contactManifold,
bool flippedManifold,
int workerIndex,
BepuSimulation bepuSimulation)
void IContactHandler.OnStartedTouching<TManifold>(ContactData<TManifold> contactData)
{
// When something enters inside this object
other.Entity.Transform.Scale = new Vector3(2.0f);
contactData.Other.Entity.Transform.Scale = new Vector3(2.0f);
}

void IContactEventHandler.OnStoppedTouching<TManifold>(CollidableComponent eventSource, CollidableComponent other,
ref TManifold contactManifold,
bool flippedManifold,
int workerIndex,
BepuSimulation bepuSimulation)
void IContactHandler.OnStoppedTouching<TManifold>(ContactData<TManifold> contactData)
{
// When something exits this object
other.Entity.Transform.Scale = new Vector3(1.0f);
contactData.Other.Entity.Transform.Scale = new Vector3(1.0f);
}
}
}
Expand Down
14 changes: 3 additions & 11 deletions en/manual/physics/triggers.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,16 @@ using Stride.BepuPhysics;
using Stride.BepuPhysics.Definitions.Contacts;
using Stride.Engine;

public class Test : StartupScript, IContactEventHandler
public class Test : StartupScript, IContactHandler
{
public bool NoContactResponse => true;

void IContactEventHandler.OnStartedTouching<TManifold>(CollidableComponent eventSource, CollidableComponent other,
ref TManifold contactManifold,
bool flippedManifold,
int workerIndex,
BepuSimulation bepuSimulation)
void IContactHandler.OnStartedTouching<TManifold>(ContactData<TManifold> contactData)
{
Log.Warning("Entered!");
}

void IContactEventHandler.OnStoppedTouching<TManifold>(CollidableComponent eventSource, CollidableComponent other,
ref TManifold contactManifold,
bool flippedManifold,
int workerIndex,
BepuSimulation bepuSimulation)
void IContactHandler.OnStoppedTouching<TManifold>(ContactData<TManifold> contactData)
{
Log.Warning("Exited!");
}
Expand Down