Skip to content

Commit 2d346b8

Browse files
committed
dsd
1 parent a20531a commit 2d346b8

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

roblox/index.html

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,39 @@
202202
}
203203

204204
/**
205-
* Creates a new ball mesh with an attached face.
205+
* Creates a glowing outline mesh for a given object.
206+
* @param {THREE.Mesh} targetMesh The mesh to create the glow for.
207+
* @param {string} glowColor The hex color for the glow.
208+
* @returns {THREE.Mesh} The glowing mesh.
209+
*/
210+
function createGlowMesh(targetMesh, glowColor) {
211+
// Create a duplicate of the ball's geometry
212+
const glowGeometry = targetMesh.geometry.clone();
213+
214+
// Create a glowing material
215+
const glowMaterial = new THREE.MeshBasicMaterial({
216+
color: new THREE.Color(glowColor),
217+
side: THREE.BackSide,
218+
blending: THREE.AdditiveBlending,
219+
transparent: true,
220+
opacity: 0.8
221+
});
222+
223+
// Create the glowing mesh
224+
const glowMesh = new THREE.Mesh(glowGeometry, glowMaterial);
225+
226+
// Scale it up slightly to create the outline effect
227+
const scale = 1.1; // 10% larger than the original mesh
228+
glowMesh.scale.set(scale, scale, scale);
229+
230+
// We need to add this to the scene separately so it is rendered after the player's main mesh
231+
scene.add(glowMesh);
232+
233+
return glowMesh;
234+
}
235+
236+
/**
237+
* Creates a new ball mesh with an attached face and a glowing outline.
206238
* @param {number} radius The radius of the ball.
207239
* @param {string} color The hex color for the ball material.
208240
* @returns {THREE.Mesh} The new mesh object.
@@ -237,6 +269,10 @@
237269
// Add the face to the ball mesh as a child
238270
ballMesh.add(facePlane);
239271

272+
// Add a glowing outline to the ball mesh
273+
const glowMesh = createGlowMesh(ballMesh, color);
274+
ballMesh.add(glowMesh);
275+
240276
return ballMesh;
241277
}
242278

0 commit comments

Comments
 (0)