# How Can I Draw Sine Waves on Screen

**URL:** <https://forums.unrealengine.com/t/how-can-i-draw-sine-waves-on-screen/298779>\
**Category:** Blueprint\
**Tags:** graph, unreal-engine, Blueprint, question\
**Created:** [November 11, 2014, 9:43pm UTC](https://forums.unrealengine.com/t/how-can-i-draw-sine-waves-on-screen/298779 "2014-11-11T21:43:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RAVaught](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RAVaught](https://forums.unrealengine.com/u/RAVaught)\
**Post date:** [November 11, 2014, 9:43pm UTC](https://forums.unrealengine.com/t/how-can-i-draw-sine-waves-on-screen/298779/1 "2014-11-11T21:43:49Z")

</div>

Hi folks,

I am looking for a way to draw the results from sine waves onto the screen, either in a stream or by offloading the results to an array and passing them to a “graph” to display in a widget. Ideally, there would be a simple way to do either or, but I am not really sure where to even start with this.

Regards

---

<div class="post-metadata">

**Author:** ![Pierdek](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pierdek](https://forums.unrealengine.com/u/Pierdek)\
**Post date:** [November 11, 2014, 9:57pm UTC](https://forums.unrealengine.com/t/how-can-i-draw-sine-waves-on-screen/298779/2 "2014-11-11T21:57:53Z")

</div>

Take a look on WheeledVehicleMovementComponent.cpp DrawTelemetryGraph

especially on

```
for ( uint32 i = 2; i < 2 * PxVehicleGraph::eMAX_NB_SAMPLES; i += 2 )
	{
		float x1 = PGraphXY[i-2];
		float y1 = PGraphXY[i-1];
		float x2 = PGraphXY[i];
		float y2 = PGraphXY[i+1];

		x1 = FMath::Clamp( x1 + 0.50f, 0.0f, 1.0f );
		x2 = FMath::Clamp( x2 + 0.50f, 0.0f, 1.0f );
		y1 = 1.0f - FMath::Clamp( y1 + 0.50f, 0.0f, 1.0f );
		y2 = 1.0f - FMath::Clamp( y2 + 0.50f, 0.0f, 1.0f );

		FCanvasLineItem LineItem( FVector2D( GraphX + x1 * GraphWidth, LineGraphY + y1 * LineGraphHeight ), FVector2D( GraphX + x2 * GraphWidth, LineGraphY + y2 * LineGraphHeight ) );
		LineItem.SetColor( FLinearColor( 1.0f, 0.5f, 0.0f, 1.0f ) );
		LineItem.Draw( Canvas->Canvas );
	}

```

this piece of code draw graph with vehicle parameters.

---

<div class="post-metadata">

**Author:** ![RAVaught](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RAVaught](https://forums.unrealengine.com/u/RAVaught)\
**Post date:** [November 11, 2014, 10:50pm UTC](https://forums.unrealengine.com/t/how-can-i-draw-sine-waves-on-screen/298779/3 "2014-11-11T22:50:05Z")

</div>

Thanks for that! Going to test it out over the next couple of days and report results before I mark this as answered. I also found this: [https://docs.unrealengine.com/latest/INT/Resources/ContentExamples/Blueprint\_Splines/index.html](https://docs.unrealengine.com/latest/INT/Resources/ContentExamples/Blueprint_Splines/index.html)

My tinker with splines as well to see if they can perform the task. Thanks for the info, Pierdek

---

<div class="post-metadata">

**Author:** ![Pierdek](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pierdek](https://forums.unrealengine.com/u/Pierdek)\
**Post date:** [November 17, 2014, 12:54pm UTC](https://forums.unrealengine.com/t/how-can-i-draw-sine-waves-on-screen/298779/4 "2014-11-17T12:54:16Z")

</div>

Meantime, I found another nice piece of code:

DrawDebugHelpers.cpp

```
void DrawDebugFloatHistory(UWorld const & WorldRef, FDebugFloatHistory const & FloatHistory, FTransform const & DrawTransform, FVector2D const & DrawSize, FColor const & DrawColor, bool const & bPersistent, float const & LifeTime, uint8 const & DepthPriority)
```

---

<div class="post-metadata">

**Author:** ![tas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tas](https://forums.unrealengine.com/u/tas)\
**Post date:** [June 22, 2015, 9:15pm UTC](https://forums.unrealengine.com/t/how-can-i-draw-sine-waves-on-screen/298779/5 "2015-06-22T21:15:39Z")

</div>

Any idea if its possible to do it directly from BP rather then c++ ?  
I mean this method is great for visualizing values over time, but what about BP only projects ?

thanks!

---

<div class="post-metadata">

**Author:** ![RAVaught](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RAVaught](https://forums.unrealengine.com/u/RAVaught)\
**Post date:** [July 20, 2015, 9:20pm UTC](https://forums.unrealengine.com/t/how-can-i-draw-sine-waves-on-screen/298779/6 "2015-07-20T21:20:04Z")

</div>

I know there is, but I can’t figure out how. There is a snap shot wave in the content examples math level, but I can’t figure out exactly what they are doing or where.
