# How to program Sin on circle

**URL:** <https://forums.unrealengine.com/t/how-to-program-sin-on-circle/463542>\
**Category:** Blueprint\
**Tags:** planet, unreal-engine, question, Blueprint\
**Created:** [April 9, 2020, 12:29pm UTC](https://forums.unrealengine.com/t/how-to-program-sin-on-circle/463542 "2020-04-09T12:29:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mateusz88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mateusz88](https://forums.unrealengine.com/u/Mateusz88)\
**Post date:** [April 9, 2020, 12:29pm UTC](https://forums.unrealengine.com/t/how-to-program-sin-on-circle/463542/1 "2020-04-09T12:29:19Z")

</div>

Hi I’d like to program a sin on Circle. Any ideas image under.

 ![299352-sin-on-circle.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/9/6/d963a174198b8c03900824c24f72dd3844313da7.jpeg)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 9, 2020, 2:17pm UTC](https://forums.unrealengine.com/t/how-to-program-sin-on-circle/463542/2 "2020-04-09T14:17:43Z")

</div>

Is this going to be in the UMG, or do you mean on a sphere?

---

<div class="post-metadata">

**Author:** ![FSapio](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fsapio/32/1194616_2.png) [@FSapio](https://forums.unrealengine.com/u/FSapio)\
**Post date:** [April 9, 2020, 3:11pm UTC](https://forums.unrealengine.com/t/how-to-program-sin-on-circle/463542/3 "2020-04-09T15:11:25Z")

</div>

Dear Mateusz88,

you can work out the math and find out that the formula you are looking for is the following:

```
x = (R+a*sin(n*t*s))*cos(t*s)
y = (R+a*sin(n*t*s))*sin(t*s)

```

where:

**R** is the _Radius_

**a** is the _Amplitude_

**n** is the number of sines functions along the circle

**t** is the _time_

**s** is the _speed_

At the end, remember to add the center of the circle  
You can either build the formula in your blueprint, or use a custom Math expression node, like in the following screenshot:

 ![299357-sinealongcircle.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/a/4/1a4d754c8c8bb7b385c6e7cbd4bbb681e18f6b4b.png)

And this is the final result:

![299358-sinealongcircleanimation7.gif](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/7/5/5753c7a2442270b3c13af36c64545441b0c96fb1.gif)

If you need other clarifications, I will be glad to help.

---

<div class="post-metadata">

**Author:** ![Mateusz88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mateusz88](https://forums.unrealengine.com/u/Mateusz88)\
**Post date:** [April 9, 2020, 4:29pm UTC](https://forums.unrealengine.com/t/how-to-program-sin-on-circle/463542/4 "2020-04-09T16:29:31Z")

</div>

Dear FSapio,  
Everything is working fine. Thank You for answer. I have another question about this shape. Is it possible to fill it with instance meshes.  
Thank You for Help.

---

<div class="post-metadata">

**Author:** ![Mateusz88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mateusz88](https://forums.unrealengine.com/u/Mateusz88)\
**Post date:** [April 10, 2020, 8:24am UTC](https://forums.unrealengine.com/t/how-to-program-sin-on-circle/463542/5 "2020-04-10T08:24:22Z")

</div>

I mean on a sphere like hills on a planet

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 10, 2020, 9:18am UTC](https://forums.unrealengine.com/t/how-to-program-sin-on-circle/463542/6 "2020-04-10T09:18:40Z")

</div>

Ok, but you have the answer now… 😉

---

<div class="post-metadata">

**Author:** ![FSapio](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fsapio/32/1194616_2.png) [@FSapio](https://forums.unrealengine.com/u/FSapio)\
**Post date:** [April 10, 2020, 1:54pm UTC](https://forums.unrealengine.com/t/how-to-program-sin-on-circle/463542/7 "2020-04-10T13:54:09Z")

</div>

By “fill it”, do you mean along the shape, or also inside it?  
To place something along the shape, you can put an angle instead of the time and use 1 for the speed. This will give you a point along this shape at that angle from the center. Just divide 2 Pi by the number of meshes you want along the shape, and use the formula every angle that you found in the division.  
To place something inside the shape, let’s say randomly, you can change the radius between a min and a max.
