Entities that already exist inside a trigger don't trigger OnTriggerEnter when the trigger spawns

Describe the bug:

If you have a trigger like this:

OnTriggerEnter will not fire for the 4 lamp posts, when the server initializes.

You can workaround this by setting the size to 0, then setting it back (even in the same frame).

function BugScript:WorkAround()
	local oldSize = self.properties.trigger.size
	self.properties.trigger.size = Vector.New(0, 0, 0)
	self.properties.trigger.size = oldSize

I realize that entities that already exist in a trigger aren’t really entering it, but if you’re tracking all of the entities that are inside of a trigger volume, you probably want to include anything that’s inside when you spawn.

Usecase: We have a trigger on the player template that tracks objects in range. Anything that enters the trigger volume is added to a local variable, anything that leaves is removed.
Since the player can spawn in a number of places, we need to account for the existing entities that end up in the trigger when they spawn.

How do you cause this bug?

  • Install the Trigger Bug package by Cereal
  • Add the Trigger Bug template to the world
  • Add the User Trigger Bug template to the user
  • Set the “Trigger” property to the trigger1 entity
  • Test with the workAround property set on/off on the user template

Which platform: PC / Stadia

Which input: Controller / keyboard + mouse

Your Crayta username: Cereal

Game seen in (including “Hub” or “Editor for XYZ”): Editor

How regularly do you see this? (E.g. 2/3 times - please try 3 times if possible): Every time

Time + date seen: Oct 31 2021

Version number (found in Help tab in Settings): 0.d5.9.111485

1 Like

Thanks for opening this!

Hello Cereal,

Thank you for reporting this issue to us.
I have opened a ticket for our internal team to investigate the issue further. :slight_smile: