Do continuous and continuous dynamic collision detection work with trigger colliders?
No. Continuous helps prevent the rigidbody from passing through the collider it collided with. With a trigger, there is no ‘collision’ in the sense of having a physics reaction.
Is there some kind of work around? If the trigger is a box can it sweep from the position in the previous frame to the position in the current frame so that the entire volume works as a trigger? (it is a rotating box though)
It seems you’re both misunderstanding each other. When Melv says “Use Queries” I believe he means use Raycast or SphereCast, not entities physics.
To get around the discrete collision detection of triggers you could try using modifiable contacts which will allow you to move an object quickly that can pass through other objects but still detect collisions. So basically create your own version of a trigger.
Thanks though I don’t think BoxCast can do what I’m after… I want the box to have a before and after rotation (and the BoxCast should sweep between them). Also it is the trigger that I’ve got moving around everywhere (it is a sword). I just decided to slow down the speed of the box trigger so that it doesn’t jump too far each frame.
So I’m making the sword blade be a trigger (with a base blade position and an end position). The choppable objects use OnTriggerEnter and OnTriggerExit.
But if the blade moves too fast the objects don’t detect the chop.
So I was thinking, there could be a trigger involving a dynamically created triangle. The points are the previous blade’s tip position, the current blade’s tip position and the current blade’s base position.
Hopefully a dynamically updated triangle could be used as a trigger and activate OnTriggerEnter and OnTriggerExit. ???
It would be better if it could also have a 4th point - the previous blade’s base position - but it sometimes wouldn’t be possible for those 4 points to be a flat surface.
When this code is used with MeshCollider the Player falls down when the mesh moves from underneath them.
When I enable isTrigger, OnTriggerEnter on another mesh is called each time the trigger is updated and touching the mesh. OnTriggerExit is never called.