Detach event after entity and entity touch||doc135530

September 20, 2022

Format

 ENTITY_APART
  • The class to which the function belongs:Entity

Description

This event is triggered when the entity object is separated from the entity object after touching the entity object.


Context

The context content of the event

name type Description
obj1 Entity leave the contact entity
obj2 Entity contacted entity


Code Samples

On the server side of the entity templatemount script, register this type of entity object when it touches other entities and then leavesCallback, destroying the entity that left

Trigger.RegisterHandler(this:cfg(), "ENTITY_APART", function(context)
    local from = context.obj1
    local to =context.obj2
    to:destroy()
end)