Currently I had a Problem as I am using transform.position.x+=10*Time.detltaTime; for my movement, my detection for my trigger is not stable(sometime it detect and sometimes it do not) as I think the way I move cause the collider detection to be unstable as it is not using the right way to do the detection.
I found a way that my detection suddenly work normally which is add a timer to to it which I think it make the ontriggerEnter only being called once per update that thus allow my detection to work.
function OnTriggerEnter(other:Collider) {
if(timer<0.1)
return ;
//Do the detection coding
timer = 0;
}
function Update() {
timer+=Time.deltaTime;
transform.position.x+=10*Time.deltaTime;
}
I wonder if this is the way to solve the detection problem if I using transform.position?
I tried before using other method like Vector3.Distance, CharacterController… but do not work better than this.