Having trouble making the click event work and linking a sphere with a URL using the latest version of three.js. Here is my code:
// Code snippet will be here
Any help or suggestions would be greatly appreciated. I'm still new to this!
Having trouble making the click event work and linking a sphere with a URL using the latest version of three.js. Here is my code:
// Code snippet will be here
Any help or suggestions would be greatly appreciated. I'm still new to this!
Solution:
To resolve this issue, ensure you have the most recent version of DomEvents from this repository, which has been updated to r74.
Explaination:
Understanding what's happening may take some time:
The use of THREEx.DomEvents
involves internal utilization of THREE.Raycaster
to detect mouse interactions with meshes. A recent change in ThreeJS
no longer allows the raycaster to intersect with invisible meshes (check source here). However, if your click event still triggers, why worry?
Let's delve into Linkify
:
THREEx.Linkify = function(domEvents, mesh, url, withBoundingBox){
withBoundingBox = withBoundingBox !== undefined ? withBoundingBox : true
// create the boundingBox if needed
if( withBoundingBox ){
var boundingBox = new THREE.Mesh(new THREE.CubeGeometry(1,1,1), new THREE.MeshBasicMaterial({
wireframe : true
}))
boundingBox.visible = false
boundingBox.scale.copy(size)
mesh.add(boundingBox)
}
// ...
If the fourth parameter withBoundingBox
evaluates to true
when not supplied, Linkify generates an invisible "bounding box mesh" that encompasses the targeted mesh. Consequently, the raycaster fails to trigger an intersection. To enable the raycaster to detect intersections even though the boundingBox is hidden, only set the visibility of the mesh's material to false, not the entire mesh:
boundingBox.material.visible = false
Currently, I am in the process of constructing a TreeView using the Treeview component from Material UI, which can be found at this link. The component I have designed below is responsible for fetching data when a node is expanded. The tree structure is s ...
Within my Angular application, I have a $scope variable defined as follows. $scope.roleList2 = [ { "roleName" : "User", "roleId" : "role1", "children" : [ { "roleName" : "subUser1", "roleId" : "role11", "collapsed" : true, "children" : [ ...
I have implemented the JavaScript code below to set the header to a fixed position when it reaches the top of the page so that it remains visible while the user scrolls. Everything appears to be functional, but the header movement is abrupt and not smooth. ...
Seeking assistance from those knowledgeable in JSReports, but open to suggestions from all... I've investigated the common issue of "unexpected token < in JSON at position 0", which typically arises when attempting to parse an HTML-formatted strin ...
I currently have my header and footer wrapping the content on all pages of my website. However, I am looking to hide the header and footer on specific pages like the customer and admin dashboard. Can anyone suggest the best approach to achieve this? cons ...
I need assistance with integrating a function called "tweeter" into my code so that it runs at specific times throughout the day - 09:00, 13:00, 17:00, and 21:00. Currently, the function runs continuously after the initial hour check is completed, instead ...
There are times when I overlook using the await keyword, for example: const foo = bar(); // as opposed to const foo = await bar(); Identifying these bugs can be challenging. Are there any methods, libraries, or tools that can help prevent such errors? ...
Is it possible to transfer an array of data from one HTML file to another? If so, how can this be done? Consider the following scenario: First HTML file <script> let tmp = <%- result %>; let a = '' for (const i in tmp){ ...
Currently, I am attempting to decrease the size of my AngularJS JavaScript code (using SquishIt). Within my module, there is a service injected as a function argument, as shown below. var myapp = angular.module('myapp', ['ngSanitize'] ...
I am currently utilizing HTML, Javascript, and bootstrap to develop a web application. However, I have encountered an obstacle. When using the code document.getElementById("input here"), it only returned an array of 0. My goal is to retrieve data from an A ...
In my function, I am retrieving data from two collections in Firestore: Media and Users. Inside the Users collection, there is a subcollection containing a list of all the user's movies. The Media collection includes details about each movie. My goal ...
One of my projects involves a simple drag element example inspired by Angular documentation. The example features a button that can be dragged around within a container and comes with a tooltip. <div class="example-boundary"> <div ...
I'm currently delving into the world of express and experimenting with express.Router() to route to various endpoints. Despite following online tutorials diligently, I am only able to successfully send text from the root '/' endpoint and not ...
I'm encountering an error while using Eventstore, specifically: Could not recognize BadRequest; The error message is originating from: game process tick failed UnknownError: Could not recognize BadRequest at unpackToCommandError (\node_modul ...
I attempted to create a multi-line chart using nvd3, but encountered roadblocks when trying to make significant modifications. I am considering building my own chart using d3js directly, but I'm finding it challenging to grasp the concept of 'thi ...
In my fast-paced, quiz-like Javascript game, users must answer a series of Yes/No questions as quickly as possible. Upon answering, the response is sent to the server for validation and feedback (correct/incorrect) before moving on to the next question usi ...
For my search functionality, I am utilizing ajax jquery js. I found this useful code snippet here: However, I am facing some challenges with the following Javascript code: <script language="JavaScript" type="text/javascript"> <!-- function searc ...
Having trouble with this specific example. The issue arises with an Input component that includes an onChange prop to manage internal data changes. Under normal circumstances, if the value is updated externally, the onChange prop does not trigger since t ...
I am currently working on a simple app where I want to display embed videos with the click of a button. It was quite challenging for me to dynamically bind my embed players, but I managed to do it successfully. I created a factory that contains my data in ...
I need to detect when the TAB key is pressed, prevent the default action from occurring, and then execute my custom JavaScript function. ...