# Implement temporary material and restore original

**URL:** <https://discourse.threejs.org/t/implement-temporary-material-and-restore-original/23430>\
**Category:** Questions\
**Tags:** materials\
**Created:** [February 12, 2021, 2:18pm UTC](https://discourse.threejs.org/t/implement-temporary-material-and-restore-original/23430 "2021-02-12T14:18:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephane\_Ancelot](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/stephane_ancelot/32/15587_2.png) [@Stephane\_Ancelot](https://discourse.threejs.org/u/Stephane_Ancelot)\
**Post date:** [February 12, 2021, 2:18pm UTC](https://discourse.threejs.org/t/implement-temporary-material-and-restore-original/23430/1 "2021-02-12T14:18:56Z")

</div>

Hi,  
I implemented collide detection in a gltf scene.  
I would like being able to setup red emissive color for colliding objects. And when they do not collide setup the original material .

How can I do this efficiently ?

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [February 12, 2021, 7:26pm UTC](https://discourse.threejs.org/t/implement-temporary-material-and-restore-original/23430/2 "2021-02-12T19:26:14Z")

</div>

Have you considered to use the same approach like in this official example?

[https://threejs.org/examples/webgl\_math\_obb](https://threejs.org/examples/webgl_math_obb)

If you can’t hard-code color values, save the original color in [Material.userData](https://threejs.org/docs/index.html#api/en/materials/Material.userData).
