# Click for Animation - How does it work?

**URL:** <https://forum.needle.tools/t/click-for-animation-how-does-it-work/1336>\
**Category:** 🌵 Needle Engine\
**Tags:** question\
**Created:** [December 14, 2022, 12:00am UTC](https://forum.needle.tools/t/click-for-animation-how-does-it-work/1336 "2022-12-14T00:00:00Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![discord-import](https://forum.needle.tools/user_avatar/forum.needle.tools/discord-import/32/33_2.png) [@discord-import](https://forum.needle.tools/u/discord-import)\
**Post date:** [December 14, 2022, 12:00am UTC](https://forum.needle.tools/t/click-for-animation-how-does-it-work/1336/1 "2022-12-14T00:00:00Z")

</div>

Can someone explain how this on click animation works step by step?  
Like what component should i add into scene or what code?

Or any direction I should work on? Anything would be helpful 🤗 .

> **[iframe Content](https://engine.needle.tools/samples/iframe-content/?url=https:%2F%2Fwww.youtube.com%2Fembed%2FpuWNRrG4MCg)**
>
> Displaying external web pages in 3D

[Original Post on Discord](https://discord.com/channels/717429793926283276/1052507847054872656)

_by user 786526940349726730_

---

<div class="post-metadata">

**Author:** ![Marcel\_Wiessler1](https://forum.needle.tools/user_avatar/forum.needle.tools/marcel_wiessler1/32/21_2.png) [@Marcel\_Wiessler1](https://forum.needle.tools/u/Marcel_Wiessler1)\
**Post date:** [December 14, 2022, 12:00am UTC](https://forum.needle.tools/t/click-for-animation-how-does-it-work/1336/2 "2022-12-14T00:00:00Z")

</div>

Hi, have you tried downloading the sample project? It contains the scene 🙂

I can otherwise explain the key components too once im at the pc 🙂

---

<div class="post-metadata">

**Author:** ![Marcel\_Wiessler1](https://forum.needle.tools/user_avatar/forum.needle.tools/marcel_wiessler1/32/21_2.png) [@Marcel\_Wiessler1](https://forum.needle.tools/u/Marcel_Wiessler1)\
**Post date:** [December 14, 2022, 12:00am UTC](https://forum.needle.tools/t/click-for-animation-how-does-it-work/1336/3 "2022-12-14T00:00:00Z")

</div>

Changed the channel name: Click for Animation - How does it work?

---

<div class="post-metadata">

**Author:** ![discord-import](https://forum.needle.tools/user_avatar/forum.needle.tools/discord-import/32/33_2.png) [@discord-import](https://forum.needle.tools/u/discord-import)\
**Post date:** [December 15, 2022, 12:00am UTC](https://forum.needle.tools/t/click-for-animation-how-does-it-work/1336/4 "2022-12-15T00:00:00Z")

</div>

Hey, I would appreciate if you explain it 😀

_by user 786526940349726730_

---

<div class="post-metadata">

**Author:** ![discord-import](https://forum.needle.tools/user_avatar/forum.needle.tools/discord-import/32/33_2.png) [@discord-import](https://forum.needle.tools/u/discord-import)\
**Post date:** [December 17, 2022, 12:00am UTC](https://forum.needle.tools/t/click-for-animation-how-does-it-work/1336/5 "2022-12-17T00:00:00Z")

</div>

It’s me again. I tried using samples by cloning. But console says ------\_\_\_\_\_\_\_--------- “Prefab instance problem: sci-fi\_computer (Missing Prefab with guid: 4226a96b591d1a940a6e235573cc8aea)”

_by user 786526940349726730_

---

<div class="post-metadata">

**Author:** ![Marcel\_Wiessler1](https://forum.needle.tools/user_avatar/forum.needle.tools/marcel_wiessler1/32/21_2.png) [@Marcel\_Wiessler1](https://forum.needle.tools/u/Marcel_Wiessler1)\
**Post date:** [December 17, 2022, 12:00am UTC](https://forum.needle.tools/t/click-for-animation-how-does-it-work/1336/6 "2022-12-17T00:00:00Z")

</div>

Oh im sorry for having forgotten to reply you :PandaSad:

---

<div class="post-metadata">

**Author:** ![Marcel\_Wiessler1](https://forum.needle.tools/user_avatar/forum.needle.tools/marcel_wiessler1/32/21_2.png) [@Marcel\_Wiessler1](https://forum.needle.tools/u/Marcel_Wiessler1)\
**Post date:** [December 18, 2022, 12:00am UTC](https://forum.needle.tools/t/click-for-animation-how-does-it-work/1336/7 "2022-12-18T00:00:00Z")

</div>

That sounds something failed while cloning the project and you’re missing some assets.

---

<div class="post-metadata">

**Author:** ![Marcel\_Wiessler1](https://forum.needle.tools/user_avatar/forum.needle.tools/marcel_wiessler1/32/21_2.png) [@Marcel\_Wiessler1](https://forum.needle.tools/u/Marcel_Wiessler1)\
**Post date:** [December 18, 2022, 12:00am UTC](https://forum.needle.tools/t/click-for-animation-how-does-it-work/1336/8 "2022-12-18T00:00:00Z")

</div>

Maybe try with a fresh clone ? I assume you opened the Needle Engine Samples project that comes with the repository (using Unity 2020.3?)

---

<div class="post-metadata">

**Author:** ![Marcel\_Wiessler1](https://forum.needle.tools/user_avatar/forum.needle.tools/marcel_wiessler1/32/21_2.png) [@Marcel\_Wiessler1](https://forum.needle.tools/u/Marcel_Wiessler1)\
**Post date:** [December 18, 2022, 12:00am UTC](https://forum.needle.tools/t/click-for-animation-how-does-it-work/1336/9 "2022-12-18T00:00:00Z")

</div>

So the basic setup for opening closing the computer is this:

1. the animator is used to play the animation for the computer to open \<\> close. It useses paramters and some simple transitions. A trigger is enabled using the Button (2)

2. the button component can be used for scene objects too. The onClick method sets the Toggle trigger on the animator

3. the ObjectRaycaster is required so that the button component receives the click event (it must be in the parent hierarchy of objects that you want to receive click events for via the IPointerEvent interfaces (which the Button component implements)

---

<div class="post-metadata">

**Author:** ![Marcel\_Wiessler1](https://forum.needle.tools/user_avatar/forum.needle.tools/marcel_wiessler1/32/21_2.png) [@Marcel\_Wiessler1](https://forum.needle.tools/u/Marcel_Wiessler1)\
**Post date:** [December 18, 2022, 12:00am UTC](https://forum.needle.tools/t/click-for-animation-how-does-it-work/1336/10 "2022-12-18T00:00:00Z")

</div>

The IFrameContent is a sample script that generates some html to render the content of another website (here some youtube link - you can change it to whatever you want) using a threejs CSS3DRenderer

 ![image.png](https://europe1.discourse-cdn.com/flex006/uploads/needle1/original/2X/1/18fb518bb85aa97ce0a0f6c2fb5017f7f742829d.jpeg)

---

<div class="post-metadata">

**Author:** ![discord-import](https://forum.needle.tools/user_avatar/forum.needle.tools/discord-import/32/33_2.png) [@discord-import](https://forum.needle.tools/u/discord-import)\
**Post date:** [December 18, 2022, 12:00am UTC](https://forum.needle.tools/t/click-for-animation-how-does-it-work/1336/11 "2022-12-18T00:00:00Z")

</div>

I truly grateful for your time, Thank you :PandaPainter:

_by user 786526940349726730_
