Hi,
I am trying to place delete/remove image ( i.e sprite) on top left of hotspot image ( i.e sprite) in a 3d scene. How can I achieve this?
//parent object3d for manipulation
var layer = new THREE.Object3D();
scene.add(layer);
//sprite for remove/delete
var textureLoader = new THREE.TextureLoader();
var map = textureLoader.load("img/close.png");
var deleteObjMaterial = new THREE.SpriteMaterial({ map: this.map });
//sprite for hotspot
var textureLoader = new THREE.TextureLoader();
var map = textureLoader.load("img/hotspot.png");
var arrowMaterial = new THREE.SpriteMaterial({map: this.map});
//onclick place hotspot sprite
var sprite = new THREE.Sprite(arrowMaterial);
sprite.scale.set(40,40,40); // imageWidth, imageHeight
sprite.position.set(posX, posY, posZ); //onclick 2d to 3d position
layer.add(sprite);
//onclick place delete image sprite on top left of hotspot
sprite = new THREE.Sprite(deleteObjMaterial);
sprite.scale.set(10, 10,10); // imageWidth, imageHeight
if (posX > 450) {
posX = posX - 40 ;
}
if (posX < -450) {
posX = posX + 40 ;
}
if (posY > 0) {
posY = posY - 40;
}
if (posY < 0) {
posY = posY + 40;
}
if (posZ > 0) {
posZ = posZ - 40;
}
if (posZ < 0) {
posZ = posZ + 40;
}
sprite.position.set(posX, posY, posZ); //onclick 2d to 3d position
layer.add(sprite);