Haven’t been able to sit down and try these yet; is it possible to use them to make a line graph? Are paths creatable via scripts?
I’ve been experimenting with Path2D and I noticed on the developer documentation it says there’s a limit of 250 control points but when I try adding more than 51 it errors with “Path2D:SetControlPoints() only supports 51 control points.”
Thanks for pointing that out, the documentation is wrong, I’ll get it updated.
Doesn’t work in SurfaceGui?
You can already achieve something similar with beizer curves I believe
but an in-engine would be nice so we can have the performance benefits!
Hi, if you want this to work, make sure the surface gui is stored under starter gui and set the adornee to the part. Then it should work. If the surface gui is a child of the part, then the input does not work correctly. Thanks
so apparently if i update it’s position of the point they will throw this error with it being “index 1 access out of bounds”
though running this with script executor (using Exestack) it didn’t seem to throw it out here.
I actually tried to set the x offset back to 0 for the left side cuz it’s where it comes from but running this for the right side still occurs but it’s gone after seconds, sometimes it just won’t visualize or it went hidden even after setting it to true.
–
Turns out they’re in the process of loading after playtested, it seems to be gone when i set position offset value to 0, still i don’t know what was going on with this.
Are there any plans to support more points in the future?
That is very awesome! Now we just wait for 3D splines, aka Path3D
If you have a repro place file, I can take a look.
Great update but I’d love to see some antialiasing for those of us who want to use this for graphs and such. Currently the options are:
-
using frames (which aren’t antialiased either, see image)
-
using editableimages (and implementing xiaolin wu’s line algorithm), but these are limited to 1024x1024
Antialiasing would really polish the visuals of this feature, I think
Actually, a slight “hack” you can do that I do often in my UI is to add a 1-pixel UICorner
to a rotated frame, and it actually forces anti-aliasing (to an extent, it smooths out the edges, at least). Pretty handy trick for UI designers. However, it’s worth noting that this trick only works if the frame is bigger than 2 pixels on each axis.
10-degree rotated frame without UICorner
:
10-degree rotated frame with UICorner
:
You can tell that the edges of the frame with the UICorner
looks smoother.
Also, FYI EditableImage
s are actually limited to 1024x1024 through normal means (although I’ve figured out how bypass this with a couple hacks, heheh.) Roblox’s arbitrary restrictions on developers (like 1000 maximum size on UIScale) drive me mad sometimes. (like, come on! 1000 isn’t even a power of 2 yet it’s so painfully close to 1024!) I don’t understand why Roblox clamps the thickness of Path2D.Thickness
to 100 pixels, either (just like BorderSizePixel
). They didn’t clamp UIStroke though (thank God). People have screens with different resolutions and DPI, so clamping these values doesn’t make sense… Maybe they clamp Path2D
because we would be able to see the individual polygons that compose the line, but us devs don’t care, we just don’t want our stuff to be restricted.
Sorry, I know that’s a lot of yapping lol, but I’m tired of Roblox’s dumb restrictions. I wish they’d just remove the clamping on stuff that makes no sense to clamp.
Will there be any native shaping support for closed paths? (i.e., Path2D:Fill()
)
Where it would (hopefully) render your closed path as a shape that would then behave similarly to an ImageLabel or Frame.
The use cases for this are boundless - native draw-fills that don’t require tedious (and most times non-performant) filling methodology.
In my case, I’d be able to use this to draw high-resolution UIs in-house instead of bunny-hopping them from Photoshop to an Alpha-bleeding plugin to Studio. On top of that, I’d finally be able to render complex shape objects for dozens of effects that most 2D engines support. I’d be able to draw metaballs, and animate this chicken properly (in this case, I animated it in 3D with a 2D projection, lol).
Also aware that this is easily doable via an EditableImage - but the question pertains more to whether or not Path2Ds themselves will be able to house this behavior natively.
Thanks!
That’s super useful! Thanks. I’ll try it out (but Roblox, don’t think I don’t want antialiasing on Path2D anymore, I still do!!!)
How would one create a circle? Has someone here tried to make a circle?
You can’t actually make an exact circle using Bezier splines. Though you can get very close, enough so that there’s no visual difference: geometry - How to create circle with Bézier curves? - Stack Overflow
If you want a circle you can find one in the textures folder here’s the imageid to use: rbxasset://textures/whiteCircle.png
If you want to visually make a circle, it’s pretty easy. You don’t need any images or the Path2D
object. For a filled circle, you can use a Frame
with a UICorner
set to a CornerRadius
of {0.5, 0}
. If you want to make the circle outline instead of fill, scale the frame to take up the empty area of the circle, set the frame’s BackgroundTransparency
to 1
, and then add a UIStroke
onto it. Then, you can set the thickness of the outline to however big you want in the Thickness
property of the stroke.
Edit: In order for it to be a perfect circle, the aspect ratio of the frame must be 1:1
. I’d recommend adding a UIAspectRatioConstraint
with AspectRatio
set to 1
or setting the SizeConstraint
of your frame to anything but Enum.SizeConstraint.RelativeXY
if your circle frame dynamically scales.
If you want to make an object follow a circular path, then I’d recommend @tnavarts’ solution.
Why doesn’t the path2d appear almost anywhere in-game? It shows up in studio, but in game it doesn’t appear if the screengui is inside a script, and not at all if its in a billboard gui.