nathanidp Posted August 9, 2018 Share Posted August 9, 2018 In my project I am working with lot of instance of object for optimization reasons. However when I select an object with the mouse I have no visual way to indicate that an instance is selected. At first I wanted to highlight the instance but it's not possible. Do you have some tricks or solution for my issue . Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 9, 2018 Share Posted August 9, 2018 You could keep only one separate object for highlight purpose. Basically it is disabled by default and when you need to highlight one instance, you could disable this instance, and put you separate object at the same position with highlight on it. This would help not breaking your perf by just adding a separate draw call for the instance when needed. Would that work for you ? Quote Link to comment Share on other sites More sharing options...
nathanidp Posted August 9, 2018 Author Share Posted August 9, 2018 You mean like this ? https://www.babylonjs-playground.com/#1KUJ0A#0 Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 9, 2018 Share Posted August 9, 2018 Yup, just using normal highlight for the mesh not part of the instances. Quote Link to comment Share on other sites More sharing options...
brianzinn Posted August 9, 2018 Share Posted August 9, 2018 You can clone (http://doc.babylonjs.com/api/classes/babylon.abstractmesh#clone): https://www.babylonjs-playground.com/#1KUJ0A#130 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 9, 2018 Share Posted August 9, 2018 https://www.babylonjs-playground.com/#1KUJ0A#133 Expansion of Brianzinn's Quote Link to comment Share on other sites More sharing options...
brianzinn Posted August 9, 2018 Share Posted August 9, 2018 1 hour ago, Pryme8 said: Expansion Cool PG, if you were wondering why it didn't highlight, it's because you can't add a clone of an instance to the Highlight Layer (there is no onBeforeRenderObservable func, which the Highlight Layer needs): https://www.babylonjs-playground.com/#1KUJ0A#134 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 9, 2018 Share Posted August 9, 2018 yeah, but I could make a work around pretty easy. 1 second. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 9, 2018 Share Posted August 9, 2018 https://www.babylonjs-playground.com/#1KUJ0A#136 this should keep it dynamic. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 9, 2018 Share Posted August 9, 2018 Nice one, work exactly as planned ? 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.