I am currently loading five elements using the STL Loader
in order to create a table. My goal is to use dat.gui
to adjust the scale of Tabletop.STL
.
Here is the code snippet:
<!DOCTYPE html>
<html lang="en>
<head>
<title>three.js webgl - STL</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
// CSS Styles Here
</style>
</head>
<body>
// HTML Body Content Here
<script>
// JavaScript Logic Here
</script>
</body>
</html>
When I apply dat.gui
to a cube created from BoxGeometry
instead of Tabletop.STL
, it works fine. However, when I load Tabletop.STL
and declare all its variables globally, I encounter an error stating:
Uncaught TypeError: Cannot read property 'scale' of undefined
within the animate()
function.
If anyone can help me identify where I might be going wrong, I would greatly appreciate it.