84328

Select Collada objects by mouse Click in Three.JS

I need to select Collada objects in Three.JS by mouse click. I know that I can select object based on their id and I saw some samples that user can interact with Geometry defined objects (here). But I need to have access to the objects in Collada format.

Answer1:

Assuming that dae_scene is a COLLADA scene returned from the ColladaLoader, here's what you can do to check for intersection:

var toIntersect = []; THREE.SceneUtils.traverseHierarchy(dae_scene, function (child) { if (child instanceof THREE.Mesh) { toIntersect.push(child); } });

This gets all Mesh objects inside the COLLADA scene. You can then use that array to look for ray intersections, like this:

var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() ); var intersects = ray.intersectObjects( toIntersect );

Recommend

  • three.js OrthographicTrackballControls with Angular
  • Three.js shadow map stripes in each light (now simplified, and with jsfiddle!)
  • Unable to compute a CMAC using Cygwin and OpenSSL
  • angular js '?' in ng-src causes infinite loop
  • How to list languages supported by my application
  • Find out specific weblogic process running
  • gridview on page won't refresh, even when calling databind again
  • Deserializing JSON to a .net base class with JSON.net
  • git-svn: automatically importing/creating svn revisions as git tags
  • jOOQ: Allowed-Character constraints?
  • DataGrid show an empty row when DataTable is empty
  • Python : How to center Label in tkinter window
  • What does this mean? (Google Maps API)
  • How do i install the cakephp forum plugin by Miles J?
  • Convert adjacency matrix to a csv file
  • Text classification extract tags from text
  • How to sort a javascript array by date
  • ASP.NET Gridview Paging Problem
  • Removing Duplicate Geometries
  • Action Pack components in Rails
  • Using MouseListener to select a range of cells in a grid
  • How to explicitly/implicitly implemented interface members in C++/CLI?
  • OOP Javascript - Is “get property” method necessary?
  • Caching attributes in superclass
  • Why Encoding.ASCII != ASCIIEncoding.Default in C#?
  • one Local Olampyad Questions on Informatic in 2011
  • Is it possible to access block's scope in method?
  • Cancel a live stream “fast motion” catch-up in Flash
  • SignalR .NET Client Invoke throws an exception
  • Font Awesome Showing Box instead of Icons
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • Apache 2.4 - remove | delete | uninstall
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • KeystoneJS: Relationships in Admin UI not updating
  • WPF Applying a trigger on binding failure
  • Benchmarking RAM performance - UWP and C#
  • Is it possible to post an object from jquery to bottle.py?
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF