How would I make it so if I am certain distance from a given entity, The 2d screen would grow to a certain size.
What I have now
var Grow = pc.createScript('grow');
Grow.attributes.add('doorEntity', {type: 'entity'});
Grow.prototype.initialize = function() {
};
// update code called every frame
Grow.prototype.update = function(dt) {
let crosshair_position = this.entity.getPosition();
let door_position = this.doorEntity.getPosition();
let distance = door_position.distance(crosshair_position);
if(distance < 2.0){
this.entity.setLocalScale(2,2,2);
}
else{
if(distance > 2.0){
this.entity.setLocalScale(1,1,1);
}
}
};