MacSkelly Posted August 2, 2016 Share Posted August 2, 2016 I want to create a kind of tool tip for my scene. What I basically did was create a Rectangle2D shape and set isVisible to false. When I click on a mesh I want the Rectangle to become visible and to track the mesh that was clicked on. I tried just setting rectangle.trackNode = mesh but it doesn't seem to work. Is there a way to do this? Does the property have a different name like with isVisible and levelVisible? I basically want to create something similar to this demo: http://babylonjs-playground.com/#1N9RJY#5 But to have it in such a way that the rectangles only appear when the corresponding mesh has been clicked on. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 2, 2016 Share Posted August 2, 2016 Hi @MacSkelly. First, the property is named trackedNode. Maybe that was the problem? Also of interest... the .trackedNode property is on Group2D objects. Does it exist on Rectangle2D objects? I'm showing it as undefined. On group2D-class objects, it is showing NULL, by default. (yay, at least it exists) http://babylonjs-playground.com/#DEFP2#4 Watch your console... some reports are sent there. This is a modification of a Nockawa demo. Lines 49-64 are the fun parts. The node-tracking seems to be working on group2D containers (g1 is a group2D-class item). This should get you rolling. Holler if you have more issues. And if you ask me why the .trackedNode is named "mesh" instead of "box" (see console messages)... I will have to reply with a delicious "I dunno". Perhaps "mesh" is a clone or instance of "box"... created by the Canvas2D author. Quote Link to comment Share on other sites More sharing options...
MacSkelly Posted August 3, 2016 Author Share Posted August 3, 2016 @Wingnut , thanks! I've got it working now. You were spot on with my errors. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.