Interactive captions

How would I make it so if the player is looking at a certain entity and the right mouse button is pressed a caption shows at the bottom of the screen. But if the player is not looking at it, or the right mouse button is released the caption will hide.

Hi @Mason_Rocchio! Do you make a first person game? If that’s the case you can probably use visibleThisFrame to check if the player is looking at the entity. Please check the topic below how to use this.

var MeshVisScript = pc.createScript('meshVisScript');

MeshVisScript.prototype.initialize = function() {
 
    this.app.scene.layers.getLayerByName("World").onPostCull = (cameraIndex) => {
        var entity = this.app.root.findByName("Box");
        var meshInstance = entity.model.model.meshInstances[0];
        console.log("visible: " + meshInstance.visibleThisFrame);
    }
};

How would I add it so the text shows when i look at it

I did something similar in the post below. (Not exactly what to use, but to point you in the right direction). I assume you’ve already learned to use some basics like findByName and enabled?