I want some texts show when the player collide with a cylinder,but my code dosen’t work.
var Success = pc.createScript('success');
Success.attributes.add('UI', {
type: 'entity',
title: 'Target UI',
description: 'The target UI which will show after success.'
});
// initialize code called once per entity
Success.prototype.initialize = function() {
this.entity.collision.on('triggerenter', this.onTriggerEnter, this);
};
Success.prototype.onTriggerEnter = function() {
this.UI.enabled = true ;
};
My project: Overview | Dashboard | MazeGame | PlayCanvas | 3D HTML5 & WebGL Game Engine