OnTriggerExit continuously called from within surrounding collider

Hi, and again I may be to stupid to get the easiest stuff right, so sry beforehand :sweat:

I tried to recreate your 3rd person character controller from the samples and did the basic setup with a world collider, a character controller and a floor. The floor cube is at 0,0,0, the world collider is 20,20,20 in scale and IsTrigger set to true. The character controller is on the IgnoreRaycast layer, startposition on 0,2,0, has a rigidbody with useGravity is true attached and the AutoReset basically copied from the samples. But when I start the scene, my cube won’t move down by gravity, but instead the onTriggerExit event is fired continuously. Oo

import { Behaviour, Collider, GameObject, Rigidbody, serializeable } from "@needle-tools/engine";
import { Vector3 } from "three";

export class AutoReset extends Behaviour {
    worldCollider?: Collider;
    startPosition?: Vector3;

    start() {
        if (!this.worldCollider) console.warn("Missing collider to reset", this);
        console.log("start position", this.startPosition);

    onTriggerExit(col) {
        if (col === this.worldCollider) {
            console.log("reached world collider");

    resetToStart() {
        if (!this.startPosition) return;
        const rb = GameObject.getComponent(this.gameObject, Rigidbody);
        //this.setWorldRotation(0, 0, 0, true);
        //this.setWorldPosition(this.startPosition.x, this.startPosition.y, this.startPosition.z);

Original Post on Discord

by user 474974683163394049

I investigated further and created a repo to check this behavior → https://github.com/FireDragonGameStudio/NeedleCharacterControllerCheck As it seems atm it is related to the ChracterController and it’s interaction with the trigger box collider. The project has a scene called “TriggerTest”, where everything is setup like the 3D character controller scene from the samples.

When working with a normal BoxCollider, everything works as it should. Box falls through the WorldBoundsTrigger and gives console logs → 1 for entering, multiple while staying and 1 for exiting the trigger collider.

by user 474974683163394049

But when I enable the box with the CharacterController instead, which is imho set up correctly, it only works (most of the time) in the first try. After reloading the page, all the Trigger events are executed multiple times.

by user 474974683163394049

What is inside the character controller hierarchy? What components do you use?

only a cube mesh for the visual part :sweat_smile:

by user 474974683163394049

Do you have by any chance a scene with the exact same issue that you can send (via Help/Needle Engine/zip scene)

Here you go :slightly_smiling_face:

by user 474974683163394049

I created a github repo too, for the “whole” package ^^

by user 474974683163394049

Thanks! Yeah having a simple scene that reproduces the error already makes it easier :slightly_smiling_face:

Im not sure but it seems like an issue in Rapier as it reports the collision to end multiple times for the capsule collider shape

I wonder if it has to do with the capsule collider being internally combined from multiple shapes that all report events

That makes sense! But wouldn’t that mean, that the capsule collider in Rapier would generally behave like this, when being used in combination with a sensor collider? :thinking:

by user 474974683163394049

It would. It is something to try with vanilla rapier