you can change the =change menu= for Customize it
But you Should Place name 2 Object for create wire and
this Code Should Execute every frame
//=========change menu===============
const A = ""; // First object (start of the wire)
const B = ""; // Second object (end of the wire)
const A_INDEX = 0, B_INDEX = 0;
const RADIUS = 1; // Wire thickness (pixels)
const SAG = 10; // Wire slack/droop (pixels; 0 = nearly straight)
const SEGMENTS = 12; // Number of segments (fewer = lighter performance-wise)
const COLOR = 0x111111;
// ==================================
const sc = runtimeScene.getLayer("").getRenderer().getThreeScene();
const a = runtimeScene.getObjects(A)[A_INDEX];
const b = runtimeScene.getObjects(B)[B_INDEX];
if (!sc || !a || !b) return;
const center = (o) => new THREE.Vector3(
o.getCenterXInScene(), o.getCenterYInScene(),
typeof o.getCenterZInScene === "function" ? o.getCenterZInScene()
: typeof o.getZ === "function" ? o.getZ() + (typeof o.getDepth === "function" ? o.getDepth() / 2 : 0)
: 0);
const p0 = center(a), p1 = center(b);
const W = runtimeScene._wire || (runtimeScene._wire = {
mesh: null, last: "", mat: new THREE.MeshBasicMaterial({ color: COLOR }),
});
// Rebuild only if one of the endpoints has moved
const key = [p0.x, p0.y, p0.z, p1.x, p1.y, p1.z].map((n) => Math.round(n * 2)).join(",");
if (key === W.last) return; W.last = key;
const mid = p0.clone().add(p1).multiplyScalar(0.5);
mid.z -= SAG; // Z is the vertical axis; decreasing Z creates a sag
const curve = new THREE.QuadraticBezierCurve3(p0, mid, p1);
const geo = new THREE.TubeGeometry(curve, SEGMENTS, RADIUS, 5, false);
if (W.mesh) {
W.mesh.geometry.dispose();
W.mesh.geometry = geo;
} else {
W.mesh = new THREE.Mesh(geo, W.mat);
W.mesh.castShadow = false;
W.mesh.receiveShadow = false;
W.mesh.frustumCulled = false;
sc.add(W.mesh);
}