collision-enter-exit
Script.entered = false
Script.exited = false
Script.hadCollision = false

function Script:UpdatePhysics()
    if self.entered then
        if self.hadCollision == false then
            if self.exited == false then
                self.exited = true
                self.component:CallOutputs("OnExit")
                self.entered = false
            end
        end
    end

    self.hadCollision = false
end

function Script:Collision(entity, position, normal, speed)
    self.hadCollision = true

    self.component:CallOutputs("OnCollide")

    if self.entered == false then
        self.component:CallOutputs("OnEnter")
        self.entered = true
        self.exited = false
    end
end
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License