it would be css3d if the elements are supposed to stick to the sides, not 2d, but also not possible with css3d because it doesn’t occlude. you would see all 6 sides at all times. unless the html planes cover the whole surface of the cube face. if that’s not the case there is no solution i am aware of for vanilla, you will have to implement occlusion. or, you use something that makes image snapshots of the html but that’s very hacky, and slow/expensive if it’s not just one static image.
and you might not even need html any longer with uikit uikit Documentation this can render dom-like controls in threejs. it supports all common ui controls, even inputs. here are some examples uikit Documentation you might want to use this if you can because it will be a lot faster and cleaner. browser css3d transforms have all sorts of weird glitches.
@drcmda, I have already built most of the dice game in vanilla js using cannon-es for physics. Can the text also be added using TextGeometry mapped to the sides of the cube just like the way I have added images in the code above?
@drcmda, I am trying with textgeo but it doesnt seem to be working for some reason I can’t see the cube-
var loader = new THREE.FontLoader();
let diceMaterials = [ ];
loader.load( 'js/fonts/robot.json', function ( font ) {
for (let i = 1; i <= 6; i++) {
var textGeometry = new THREE.TextGeometry( i , {
font: font,
size: 0.8,
height: 0.8,
});
diceMaterials.push(textGeometry)
}
});
const boxGeo = new THREE.BoxGeometry(2, 2, 2);
const boxMesh = new THREE.Mesh(boxGeo, diceMaterials);