Tooltip for 3d model

On mouseover tooltip message should display as ashown in below image.
image

		root.position.x = 2;

		const imageCanvas = document.createElement('canvas');

		const imageContext = imageCanvas.getContext('2d');
		let url = 'https://devum-client-public-bucket.s3.amazonaws.com/winterdev/images/images/Arrow'

		const image = new Image();
		image.crossOrigin = "*";
		image.src = url;

		image.onload = function () {

			imageCanvas.width = image.width;
			imageCanvas.height = image.height;
			imageContext.drawImage(image, 0, 0, imageCanvas.width, imageCanvas.height);

			const imageTexture = new THREE.CanvasTexture(imageCanvas);
			const imageSpriteMaterial = new THREE.SpriteMaterial({
				map: imageTexture,
				alphaTest: 0.8,
				color: 'rgb(165, 42, 42)'
			});
			const imageSprite = new THREE.Sprite(imageSpriteMaterial);
			const imageSize = 2;
			imageSprite.scale.set(imageSize, imageSize, 0);
			root.add(imageSprite);


			// Create a canvas and set up the context
			const labelCanvas = document.createElement('canvas');
			const labelContext = labelCanvas.getContext('2d');

			// Measure text height to position correctly
			const text = 'Hello World';
			const textWidth = labelContext.measureText(text).width;

			// Set canvas size
			labelCanvas.width = textWidth + 500;  // Adjust size as needed
			labelCanvas.height = 256;

			// Set the font properties
			labelContext.font = '40px Arial';
			labelContext.fillStyle = 'black';
			labelContext.textAlign = 'center';

			// Set textBaseline to 'top' to prevent cutting off at the top
			labelContext.textBaseline = 'top';


			labelContext.fillText(text, 25, 24);  // Draw the text

			// Create a texture from the canvas
			const labelTexture = new THREE.CanvasTexture(labelCanvas);

			// Create a sprite material using the texture
			const labelMaterial = new THREE.SpriteMaterial({ map: labelTexture });

			// Create the sprite and add it to the scene
			const labelSprite = new THREE.Sprite(labelMaterial);
			root.add(labelSprite);

			scene.add(root);
		}
	
	}

In the current code, the label is always displayed, but in my use case, the text should only appear on mouseover. Can someone help me modify it?

In below example text is displaying top and bottom
https://codepen.io/prisoner849/pen/dPyKqVe

Hi!
For interactivity, you can use Raycaster :thinking:

There are some examples: three.js examples

using raycaster to get selected object, but the positioning is incorrect on mouseover.

This phrase explains not that much. Any chance to provide a minimal working and editable example, that demonstrates the issue?

Hello @prisoner849
Could you please help me with the following example? I’ve added a mouseover event, but nothing is being displayed on hover. The use case is that some text should appear when the user hovers over on the model.

https://stackblitz.com/edit/stackblitz-starters-v96vbp?file=src%2Fthree-js-lib%2Fcomponents%2Fbasic-scene.component.ts