Trigger doesn't respond to collisions from above and below (z-axis)

Describe the bug:
A trigger box that is colliding with a voxelmesh entity moving on the z-axis returns false when calling triggerbox:IsOverlapping(voxelmeshEntity).

In the same fashion when another trigger is colliding via movement on the x- and y-axis, it works fine and returns true for above function call.

How do you cause this bug?
I have a while loop that changes the position of a trigger box while triggerbox:IsOverlapping(voxelmeshEntity) is true.

The trigger that is moving on the z-axis does not report any collisions happening, so the while loop continues on into infinity.

Screenshots / video of bug:

Which platform: PC / Stadia

Which input: Controller / keyboard + mouse

Your Crayta username:

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

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

Time + date seen:
last time was 25-10-18:55, but it has been a problem for a while.

Version number (found in Help tab in Settings):
v. 0.D5.9.111.485

(PC only) hardware specs (upload dxdiag file if possible - Open and run DxDiag.exe):

The more information you provide, the more likely it is that this bug can be fixed quickly! Also, if this was discussed in Discord / Reddit / elsewhere, it might help to include a screenshot of that discussion!

Hi Victorious,

If I create a simple scene and drop down into the trigger on the Z-axis it always seems to trigger correctly, you said something about adding a script to move the trigger? Can you give some more explanation on this script and you use case?

Just FYI, I wouldn’t rely on moving a trigger to detect correctly, triggers should really be static. It might be this is the cause of unusual behaviour. I guess if you can tell me what you’re trying to do then maybe we can look at a solution.

Thanks Stuart, well then I have my answer kind off. My triggers aren’t static at all. I have 6 triggers

  • x-Plus, x-Minus
  • y-Plus, y-Minus
  • z-Plus, z-Minus

*These are owned by ProbeScript, which takes each trigger and does a binary-search inspired expedition by moving them until it finds the position where the trigger does not overlap anymore with the voxelmesh.

  • The ProbeScript then saves each of the outer edges of the voxelmesh that it is attached to.

  • First it takes the found measurements and divides that distance up data into parts

  • Then it clones the parent voxelmesh as many times as the measurements data was cut up (so take the entire volume, divide those numbers into 4 parts, clone the mesh 4 times)

  • Use setVoxelBox with nil to make everything but the measurements area visible for that clone.

  • You have achieved primitive voxel mesh fracturing!

The script works great, except that only the Z-triggers’ measurements are not dependable. If I rotate the parent voxelmesh on its side and have the X- or Y-triggers do the measurement it works, but is very inelegant.

I’m trying to develop the ProbeScript into an extension of the Destructor package.

Oh, I thought you meant this was a player character as their physics can have issues with triggers in some circumstances. I think I will try to look at the package and see what we find. Maybe there is some issue there that needs a fix?

Oh no, I think you misunderstood. the ProbeScript I am developing now, to be included in the Destructor package. But it is not available in the package yet.

I do the measurement via a

while not self.found do
    triggerbox_Z_Axis:SetPosition(triggerbox_Z_Axis.currentPosition + Vector.New(0,0,12.5)
    local found = triggerbox_Z_Axis:IsColliding(voxelmesh)
    if found then
         self.found = true
        return self.found


Hi, Sorry about this but I have only just come back to look at this today. I honest cannot see the issue that you are having. I have created a small scene with a voxel mesh and using code similar to the one you provided it always shows that I am intersecting with a voxel mesh in the Z direction.

Here is the scene I have setup, the console print out is where the voxel has been found.

Cool StuartF, you tried the setup out and aso got output :smiley: .
This looks similar to output I am also getting from my X- and Y-triggers (moving on those axes). Only when it’s time for the Z-trigger, it doesn’t pick up on any collision, colliding and overlapping many times without firing.
Right now I am thinking I need to find a different way to schedule the triggers’ ‘probing’ for it to work. Also given the info that triggers are actually supposed to be used as static devices, haha. I’m going to keep working on the mesh splitter on the x- & y-axis for now… To be continued :sunglasses:

I may as well share my example, maybe you can try it?

I set my trigger size to 50,50,50 and then dropped the script on it.

Script is below, it could probably be optimized:

local CheckTrigger = {}

-- Script properties are defined here
CheckTrigger.Properties = {

--This function is called on the server when this entity is created
function CheckTrigger:Init()
	otherEntity = nil
	local triggerbox = self:GetEntity()
	self:Schedule( function ()
		while not self.found do
    		triggerbox:SetPosition(triggerbox:GetPosition() + Vector.New(0,0,-12.5))
    		local found = self:OnOverlap()
    		if found then
    			Print("Found at",triggerbox:GetPosition())
    			self.found = true
	end )

function CheckTrigger:OnOverlap()
	if not otherEntity then
	if self:GetEntity():IsOverlapping(otherEntity) then
		return true
	return false

function CheckTrigger:OnTriggerEnter(other)
	otherEntity = other

return CheckTrigger
1 Like