| 开发者 | callahancodes |
|---|---|
| 更新时间 | 2026年2月17日 23:57 |
| PHP版本: | 5.0 及以上 |
| WordPress版本: | 6.9 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
[ti3d_scene] shortcode. Developers can also use the [ti3d_sceneinject] shortcode to call project-specific libraries from THREE and use them within custom scripts.
Check your Camera Position, Geometry Position, or Geometry Rotation. Ensure the camera position isn't inside the mesh position.
This happens when using multiple TI implementations. Stick to using just blocks or either shortcodes on a single page (avoid mixmatching both TI blocks and TI shortcodes on a single page). This warning shouldn't break anything, as it's just a warning, but will slow that page's loading speed.
Place the shortcode [ti3d_sceneinject module1 module2 ...], then add the TI id to a div and your script in a Custom HTML block.
[ti3d_sceneinject orbitcontrols axeshelper]
Example Script:
`
document.addEventListener('three-modules-ready', () => {
const scene = new THREE.Scene();
const container = document.getElementById('ti');
const width = container.clientWidth;
const height = container.clientHeight;
const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);
camera.position.z = 5;
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
renderer.setSize(width, height);
container.appendChild(renderer.domElement);
const geometry = new THREE.BoxGeometry(2, 2, 2);
const material = new THREE.MeshNormalMaterial();
const cube = new THREE.Mesh(geometry, material);
scene.add(cube);
if (THREE.AxesHelper) {
const axesHelper = new THREE.AxesHelper(3);
scene.add(axesHelper);
}
let controls;
if (THREE.OrbitControls) {
controls = new THREE.OrbitControls(camera, renderer.domElement);
}
function animate() {
requestAnimationFrame(animate);
cube.rotation.x += 0.01;
cube.rotation.y += 0.01;
if (controls) controls.update();
renderer.render(scene, camera);
}
animate();
});
`