Equivalent of canvas arc() in Babylon

Is there an equivalent of the canvas arc() webGL call in Babylon?

Arc() draws a 3 point spline that passes through (and uses radius of) a given midpoint and uses the angle of the endpoints to limit the segment length size. Which is, exactly what I need a spline to do right now.

https://www.w3schools.com/tags/canvas_arc.asp

This is different than what I can achieve via a quadratic Bezier curve3 object Babylon has.

Does this already exist in the engine somewhere or has anyone already built a function that does this?

OK, I figured it would be quicker to just build it.

This works and spits out both a Curve3 and a series of points and mimics the Arc in WebGL,

I still need to tie in an X Z offset. All radius will render from 0,0,0 until I get around to adding in an X Z offset - unless someone beats me too it.

No error checking yet, just quick and dirty, but get’s the job done.

I don’t know why the playground does not recognize the MATH.xxx methods. Work’s fine in a typescript compiler.

https://playground.babylonjs.com/#QEZAUH#1

1 Like