Trigger area not work ... what am I doing wrong?

0

this is how I connect to the bus on the OnActivate in the Lua script:

self.triggerHandler = TriggerAreaEntityNotificationBus.Connect(self, self.entityId)

this is my method to handle the event:

    function triggerDoor:OnEntityEnteredTriggerArea(entityId)
Debug.Log("------- TRIGGERED.")
end

The trigger component is configured using default settings, with capsule or boxshape.

But the event does not trigger...

What else should I configure?

Thanks a lot!

asked 7 years ago202 views
6 Answers
0
Accepted Answer

Hey @REDACTEDUSER Cheers!

answered 7 years ago
0

@REDACTEDUSER

I have changed, but still not triggering the OnTriggerAreaEntered

This is the Lua Script.

	function triggerDoor:OnActivate()
self.triggerHandler = TriggerAreaEntityNotificationBus.Connect(self, self.entityId)
Debug.Log("OnActivate ")
end
function triggerDoor:OnTriggerAreaEntered(entityId)
Debug.Log("------- TRIGGERED.")
end
function triggerDoor:OnEntityExitedTriggerArea(entityId)
Debug.Log("------- TRIGGERED.")
end
<br>

REMOVEDUPLOAD

answered 7 years ago
0

I read this in the documentation, but I could not find the checkbox.

"Note

You must use a physics component and select the Proximity Triggerable check box in order for an entity to interact with the trigger areas."

Also

At the class TriggerAreaComponent.cpp we have these two lines:

<em>EBUS_EVENT_ID(GetEntityId(), TriggerAreaNotificationBus, OnTriggerAreaEntered, entityId);
EBUS_EVENT_ID(entityId, TriggerAreaEntityNotificationBus, OnEntityEnteredTriggerArea, GetEntityId());
<br></em>
answered 7 years ago
0

@REDACTEDUSER

To help others:

	function puzzeCamera:OnActivate()
self.triggerHandler = TriggerAreaNotificationBus.Connect(self, self.entityId)
end
function puzzeCamera:OnDeactivate()
self.triggerHandler:Disconnect()
end
function puzzeCamera:OnTriggerAreaEntered(entityId)
Debug.Log("------- TRIGGERED.")
end
function puzzeCamera:OnTriggerAreaExited(entityId)
Debug.Log("------- saiu TRIGGERED.")
end

answered 7 years ago
0

Awesome—thanks for solving and sharing!

answered 7 years ago
0

Hey @arineto, thanks for testing that out — I did notice one more thing. Let's give it a try! Please replace TriggerAreaEntityNotificationBus.Connect(self, self.entityId) with TriggerAreaNotificationBus.Connect(self, self.entityId). You may need to re-browse the Lua file in the Lua Script Component for the script to work :)

answered 7 years ago

This post is closed: Adding new answers, comments, and votes is disabled.