[SOLVED] Triggerenter event not working on ios devices

Trigger event is not working while laying the game on iphone but is working fine on android devices.
this.entity.collision.on(‘triggerenter’, this.onTriggerEnter, this);

Hi @yash_mehrotra! Can you please share the editor link of the project?

@Albertos found this issue in the iphone log.

[vehicle.js?id=120307025&branchId=dbbb0b55-df3f-41fe-ae92-fea872076733:914]: TypeError: navigator.vibrate is not a function. (In ‘navigator.vibrate(100)’, ‘navigator.vibrate’ is undefined)

---------- navigator.vibrate is working on android but not on ios devices.

I have used this in my code -

navigator.vibrate = (navigator.vibrate ||
navigator.webkitVibrate ||
navigator.mozVibrate ||
navigator.msVibrate);

navigator.vibrate(100);

A quick search on Google tells me that there is no support on iOS for this.

1 Like

Yeah thought so. I would move the code within the blocks then.

if(navigator.vibrate) {}

1 Like