# On hover change color for instanced mesh

**URL:** <https://forum.babylonjs.com/t/on-hover-change-color-for-instanced-mesh/12592>\
**Category:** Questions\
**Created:** [July 17, 2020, 3:15pm UTC](https://forum.babylonjs.com/t/on-hover-change-color-for-instanced-mesh/12592 "2020-07-17T15:15:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cybedred](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cybedred/32/11445_2.png) [@cybedred](https://forum.babylonjs.com/u/cybedred)\
**Post date:** [July 17, 2020, 3:15pm UTC](https://forum.babylonjs.com/t/on-hover-change-color-for-instanced-mesh/12592/1 "2020-07-17T15:15:00Z")

</div>

Hello BABYLON folks!  
This is my first post here, and first of all let me thank you for this awesome engine!  
I am deeply and truly amazed: Features, Docs, Forum, Community, Youtube channel, Playground, Sandbox, Inspector, Editors for all kinds of stuff. Absolutely mind-blowing. Breathtaking!

After start of my journey back in Mart 1, I finally get stuck. The problem is pretty described in topic title.  
here is my solution so far (if it doesn’t render please drag camera a little)  
[https://playground.babylonjs.com/#XQ7IFU#2](https://playground.babylonjs.com/#XQ7IFU#2)  
I guess I can pinpoint the problem to single thing:  
find **index** of instanced mesh to change data in sourcemesh vertex buffer  
thanks in advance

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [July 17, 2020, 4:18pm UTC](https://forum.babylonjs.com/t/on-hover-change-color-for-instanced-mesh/12592/2 "2020-07-17T16:18:57Z")

</div>

You can use the `registerInstancedBuffer` method instead of handling the vertex buffer data yourself.

That way, you can access the color property of each instance right on the instance mesh itself, making everything easier:

[https://playground.babylonjs.com/#XQ7IFU#3](https://playground.babylonjs.com/#XQ7IFU#3)

---

<div class="post-metadata">

**Author:** ![cybedred](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cybedred/32/11445_2.png) [@cybedred](https://forum.babylonjs.com/u/cybedred)\
**Post date:** [July 17, 2020, 4:36pm UTC](https://forum.babylonjs.com/t/on-hover-change-color-for-instanced-mesh/12592/3 "2020-07-17T16:36:34Z")

</div>

Simply brilliant. Thank you.

Just to wrap this up, here is final solution  
[https://playground.babylonjs.com/#XQ7IFU#4](https://playground.babylonjs.com/#XQ7IFU#4)
