Delay issue when object collide with other

I got some issue in my game when my object collided with others its does not give the response on the time. It gives the response after a few seconds. Need some help.

can you share your code?

1 Like

--------------CODE------------------

Collision.attributes.add(‘Gamelevel’,{type:‘entity’});
Collision.prototype.initialize = function() {
this.entity.collision.on(‘triggerenter’, this.onTriggerEnter, this);
};

Collision.prototype.onTriggerEnter = function(event)
{
console.log(event.name);

if(event.name =="objectmove")
   {
    
     
      event.enabled=false;
      this.Gamelevel.enabled = true;
      
        
    }

};

Hi @HasnainX,

Check the following tutorial on how collision callbacks work and what value they return:

https://developer.playcanvas.com/en/tutorials/collision-and-triggers/

1 Like

Thank you