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
Stadia
Which input: Controller / keyboard + mouse
Both
Your Crayta username:
Victorious
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
Remember!
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!
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)
Wait()
local found = triggerbox_Z_Axis:IsColliding(voxelmesh)
if found then
self.found = true
return self.found
end
end
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.
Cool StuartF, you tried the setup out and aso got output .
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
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))
Wait()
local found = self:OnOverlap()
if found then
Print("Found at",triggerbox:GetPosition())
self.found = true
end
end
end )
end
function CheckTrigger:OnOverlap()
if not otherEntity then
return
end
if self:GetEntity():IsOverlapping(otherEntity) then
return true
end
return false
end
function CheckTrigger:OnTriggerEnter(other)
otherEntity = other
end
return CheckTrigger