Test: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
Line 16: | Line 16: | ||
</table> | </table> | ||
<html> | |||
<head> | |||
<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"></script> | |||
</head> | |||
<body> | |||
<model-viewer id="bearModel" | |||
src="https://survivalcraft.wiki/content/Models/Bear.glb" | |||
ar shadow-intensity="1" | |||
camera-controls touch-action="pan-y"> | |||
</model-viewer> | |||
<script type="module"> | |||
const modelViewer = document.querySelector('#bearModel'); | |||
modelViewer.addEventListener('load', () => { | |||
const THREE = modelViewer?.threejs; | |||
if (!THREE) { | |||
console.error('threejs not exposed by <model-viewer>'); | |||
return; | |||
} | |||
// Find the mesh/material to change | |||
modelViewer.model.scene.traverse((node) => { | |||
if (node.isMesh) { | |||
const loader = new THREE.TextureLoader(); | |||
loader.load('https://survivalcraft.wiki/content/Textures/Creatures/Bear_Brown.png', (texture) => { | |||
// Apply to material | |||
node.material.map = texture; | |||
node.material.needsUpdate = true; | |||
}); | |||
} | |||
}); | |||
}); | |||
</script> | |||
</body> | |||
</html> | </html> |
Revision as of 17:29, 28 July 2025
This is a notice message |
This is a content issue |
This is a style issue |
Cell 1 | Cell 2 |
Cell 3 | Cell 4 |