I created a spherical shape using the following function
let createBall = () => {
let geoBall = new THREE.SphereGeometry(5, 32, 16);
let mat = new THREE.MeshPhongMaterial({ color: "red", transparent: true });
ball = new THREE.Mesh(geoBall, mat);
ball.position.set(0, 5, 0);
ball.geometry.dynamic = true;
ball.geometry.verticesNeedUpdate = true;
ball.geometry.__dirtyVertices = true;
scene.add(ball);
};
I then called this function within the window.onload function. Additionally, I utilized dat GUI to modify the geometry attribute, specifically the widthSegment of the ball's geometry as shown below
ballFolder
.add(ball.geometry.parameters, "widthSegments", 1, 64, 1)
.onChange(function () {
console.log(geoBall);
ball.geometry.dispose();
ball.geometry = geoBall.clone();
});
Upon logging the geoBall in the console, it appears that the attribute has been altered, but the object itself remains unchanged. Does anyone have a solution for this issue?