I am struggling to make each object open a new page using a URL when clicked. No matter what I try, it doesn't seem to work properly. Can someone point out what I might be missing or doing wrong? Here is the click event code for the objects. If needed, I can provide more code.
function onClick(event) {
event.preventDefault();
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
raycaster.setFromCamera(mouse, camera);
let objects = [aboutme, skills, interests, projects, contact];
var intersects = raycaster.intersectObjects(objects, true);
if (intersects.length > 0) {
console.log('Intersection:', intersects[0].objects); //this works
window.open(intersects[0].objects);
}}
When I modify the code like this,
if (intersects.length > 0) {
console.log('Intersection:', intersects[0].objects);
window.open('https://www.google.com',intersects[0].objects);
}
It seems to work but all models lead to the same google website when clicked.