Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
xzzy
Mar 5, 2009

Suspicious Dish posted:

Isn't this like the fifth ui rewrite they've done

UI toolkits are hilariously hard to develop, they're in a constant state of being completely rewritten. The "ugh this code all sucks let's start over from scratch" reaction is obviously a thing that happens to all code but with UI stuff it's another level of hell.

Adbot
ADBOT LOVES YOU

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.

Suspicious Dish posted:

Isn't this like the fifth ui rewrite they've done

Writing "one UI to rule them all" is pretty tricky

TIP
Mar 21, 2006

Your move, creep.



TooMuchAbstraction posted:

OK, use TextMeshPro for your text. You can write scripts to adjust character transparency on the fly or do things like make it bounce, change color, etc.

Thanks for the overview, I'm probably making this harder on myself by wanting to create everything in code.

God, I wish UIElements was in a useable state. The project I'm working on is converting a webapp to Unity, so it would be way easier.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Tip posted:

Thanks for the overview, I'm probably making this harder on myself by wanting to create everything in code.

If nothing else, you're increasing your iteration time by having to run the game each time you want to look at your UI. Being able to visualize things in the editor is pretty nice.

But it is possible to create UI entirely from code. Make an empty GameObject, add a layout controller to it like VerticalLayoutGroup or GridLayoutGroup, add items as children to the panel's gameobject, set those items' pivots/sizes/anchors (some of these will be set automatically by the layout controller, depending on its settings).

TIP
Mar 21, 2006

Your move, creep.



TooMuchAbstraction posted:

If nothing else, you're increasing your iteration time by having to run the game each time you want to look at your UI. Being able to visualize things in the editor is pretty nice.

But it is possible to create UI entirely from code. Make an empty GameObject, add a layout controller to it like VerticalLayoutGroup or GridLayoutGroup, add items as children to the panel's gameobject, set those items' pivots/sizes/anchors (some of these will be set automatically by the layout controller, depending on its settings).

Well, what I'm working on right now isn't really general UI, but it is flat text so I'm using the UI system. The main component of my game involves randomly generated text scrolling over 3d backgrounds.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

KillHour posted:

Now it's all CSS and generic web-based stuff.
Ughhh. If there's one thing everybody should have learned from Scaleform, it's "don't build your UI system on something with a feature set dictated by an entirely different market.".

Zaphod42 posted:

Writing "one UI to rule them all" is pretty tricky
I'm kind of a fan of how Godot does it, which to just treat it as an extension of the existing scene management machinery.

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'

OneEightHundred posted:

Ughhh. If there's one thing everybody should have learned from Scaleform, it's "don't build your UI system on something with a feature set dictated by an entirely different market depend on game engineers to have the knowledge or time to make a UI system that is actually useful for UI development."

I know that I only ever really post here anymore to say this, but game UI dev sucks because game UI systems are universally terrible for actually making UIs in. If this new Unity UI is web standards (I haven't read about it yet) then it could be really good, but I'm sure Unity will find a way to gently caress it up.

Scaleform was great. Chromium would be god-tier.

xzzy
Mar 5, 2009

dupersaurus posted:

I know that I only ever really post here anymore to say this, but game UI dev sucks because game UI systems are universally terrible for actually making UIs in. If this new Unity UI is web standards (I haven't read about it yet) then it could be really good, but I'm sure Unity will find a way to gently caress it up.

Scaleform was great. Chromium would be god-tier.

UI dev sucks everywhere. I developed with xlib a long time ago and it was just as bad. Everything that's replaced xlib has been agony too.

As soon as you get beyond the hello world button demo, it all becomes a mudpit.

Chromium or anything that implemented a DOM would definitely be a massive upgrade. html+css can be painful but it's the least bad layout system I've ever encountered.

Absurd Alhazred
Mar 27, 2010

by Athanatos
I've shilled for it before, but we've had a good experience with Dear ImGui, which is a lot like Unity's IMGUI.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

dupersaurus posted:

I know that I only ever really post here anymore to say this, but game UI dev sucks because game UI systems are universally terrible for actually making UIs in. If this new Unity UI is web standards (I haven't read about it yet) then it could be really good, but I'm sure Unity will find a way to gently caress it up.
I think it's a bad idea because it's largely defining the limits of its feature set in terms of what a web page can do, and like with Flash, W3C is not going to expand the feature set of the web to accommodate things that a game needs.

Last 2 games I worked on had a lot of AR-style 3D UI and it was made much less painful by the UI system understanding what "3D" is.

Godot's approach is also nice because the barrier between the game world and UI doesn't really exist, so there's much less fudging with a "UI system" that exists in an entirely separate universe.

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'

OneEightHundred posted:

I think it's a bad idea because it's largely defining the limits of its feature set in terms of what a web page can do, and like with Flash, W3C is not going to expand the feature set of the web to accommodate things that a game needs.

Last 2 games I worked on had a lot of AR-style 3D UI and it was made much less painful by the UI system understanding what "3D" is.

Godot's approach is also nice because the barrier between the game world and UI doesn't really exist, so there's much less fudging with a "UI system" that exists in an entirely separate universe.

Sure, sometimes you need more than a render target stuck in 3D space somewhere. There are things that require engine assistance, or even an intermediary engine-level UI component. But when you eventually get down to "and now I need to draw some 2D stuff", what more do you really need?

And that's not talking about menu-level interfaces, which the web model is made for.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

dupersaurus posted:

Sure, sometimes you need more than a render target stuck in 3D space somewhere. There are things that require engine assistance, or even an intermediary engine-level UI component. But when you eventually get down to "and now I need to draw some 2D stuff", what more do you really need?
I'm sympathetic to Unity having to constantly question their GUI APIs because they're dealing with people trying to put a lot more juice into their user experiences than a typical app. There are certain conventions for 2D GUIs that require a certain level of quality, and adding effects on to that will even degrade that experience. In games, there's also standards but a whole lot more moving poo poo around and effects to deal with.

For example, I never have to worry about making a high-contrast HUD for a desktop application and I'd be an rear end in a top hat if I did. If I were making a space game, there's multiple panels of that stuff all over the cockpit and it looks like it belongs there.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
the shop inventory dialog in diablo 2 is probably more complicated than the gmail ui tbh and somehow gmail runs at 2fps

TIP
Mar 21, 2006

Your move, creep.



Fun fact: in C# the dynamic keyword is supported by Windows and Android, but not iOS. Time to rewrite a ton of code! :bang:

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Tip posted:

Fun fact: in C# the dynamic keyword is supported by Windows and Android, but not iOS. Time to rewrite a ton of code! :bang:

I'm assuming if I use a library that has that in it that I'd also get screwed if I target iOS...

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

dupersaurus posted:

Sure, sometimes you need more than a render target stuck in 3D space somewhere. There are things that require engine assistance, or even an intermediary engine-level UI component. But when you eventually get down to "and now I need to draw some 2D stuff", what more do you really need?
For simple stuff, it might not matter, but for a general-purpose engine that's supposed to be useful for a lot of different situations, I think it's an unnecessary handicap, and it sacrifices a lot of control over its design.

quote:

which the web model is made for.
... sort of? There's stuff that works on the web that's made for it, but the web model is "for" pages that constrain horizontal and scroll vertical with relatively static layouts composed of non-overlapping elements, and everything more exciting than that has been retrofitted on top of that.

I'd say the "web model" is much more made for page layout than UI, especially the kind of UI you'd want in a game.

Suspicious Dish posted:

the shop inventory dialog in diablo 2 is probably more complicated than the gmail ui tbh and somehow gmail runs at 2fps
... and a lot of that "more exciting stuff" relies on JS and page layout update machinery that burns a really excessive amount of CPU.

OneEightHundred fucked around with this message at 21:05 on Dec 14, 2019

TIP
Mar 21, 2006

Your move, creep.



Rocko Bonaparte posted:

I'm assuming if I use a library that has that in it that I'd also get screwed if I target iOS...

Yeah, which might include anything that targets C# 4.0 or higher, and 4.0 was released in 2010.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Tip posted:

Yeah, which might include anything that targets C# 4.0 or higher, and 4.0 was released in 2010.

What about async/await? Is that kosher?

I am not really thinking about iOS but I am wondering about assumptions I have made for this async-await-aware .NET Python interpreter I have been toying with for embedding scripting into my game project. And yes, I know that's hosed up. I had other reasons to try it...

TIP
Mar 21, 2006

Your move, creep.



Rocko Bonaparte posted:

What about async/await? Is that kosher?

Async/await was added in C# 5, so later than the dynamic keyword, but it appears to be supported on iOS according to this article:
https://docs.microsoft.com/en-us/xamarin/cross-platform/platform/async

I'd suggest maybe throwing together a quick test and running it on iOS before putting too much time into it.

I'm using Unity and just sticking to 2.0 because Unity promises all features will work on all their supported platforms.


quote:

Cross-platform compatibility

Unity aims to support the vast majority of the APIs in the .NET Standard 2.0 profile on all platforms. While not all platforms fully support the .NET Standard, libraries which aim for cross-platform compatibility should target the .NET Standard 2.0 profile. The .NET 4.x profile includes a much larger API surface, including parts which may work on few or no platforms.



Rocko Bonaparte posted:

I am not really thinking about iOS but I am wondering about assumptions I have made for this async-await-aware .NET Python interpreter I have been toying with for embedding scripting into my game project. And yes, I know that's hosed up. I had other reasons to try it...

Running a python interpreter in your game sounds like the kind of thing that might run afoul of Apple's policies. I think it's fine if you're only running included scripts, but if you're allowing code entry or externally loading scripts in anyway you'll probably have problems.

Life would be so much easier if I didn't have to worry about Apple.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Tip posted:

I'd suggest maybe throwing together a quick test and running it on iOS before putting too much time into it.

I'm using Unity and just sticking to 2.0 because Unity promises all features will work on all their supported platforms.
I don't actually have an iOS-related device on which to test. It's just the normal thing: I ingest oxygen and food, then convert it into overengineering and analysis paralysis. So I worry about some non-existent opportunity cost from turning my back on a possible target platform for a project that I'll never finish. But it's still very important, of course.

I had previously been just using IEnumerable coroutines in the code but it get really, really hideous. Every time I entered a code block that could possibly be implemented with something asynchronous, I had to wrap it in a foreach to run it out to get the result. This would create a cascade of foreach's up and up and up. I prototyped async-await instead and found a lot of code collapsed down into one-liners that had all that crap before. I think it's still a mess if I'm recursing on an async method, but I imagine that's also a problem in native C#.

quote:

Running a python interpreter in your game sounds like the kind of thing that might run afoul of Apple's policies. I think it's fine if you're only running included scripts, but if you're allowing code entry or externally loading scripts in anyway you'll probably have problems.

Life would be so much easier if I didn't have to worry about Apple.

I kind of assume this is a problem elsewhere. If I'm using that for my game scripting and not necessarily pushing some modding API, is that okay? If I don't have the standard library implemented at all for general programming, is that fine? I can imagine it being a shitshow if I'm exposing file I/O calls to the entire filesystem or something.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Rocko Bonaparte posted:

I don't actually have an iOS-related device on which to test. It's just the normal thing: I ingest oxygen and food, then convert it into overengineering and analysis paralysis. So I worry about some non-existent opportunity cost from turning my back on a possible target platform for a project that I'll never finish. But it's still very important, of course.

I had previously been just using IEnumerable coroutines in the code but it get really, really hideous. Every time I entered a code block that could possibly be implemented with something asynchronous, I had to wrap it in a foreach to run it out to get the result. This would create a cascade of foreach's up and up and up. I prototyped async-await instead and found a lot of code collapsed down into one-liners that had all that crap before. I think it's still a mess if I'm recursing on an async method, but I imagine that's also a problem in native C#.


I kind of assume this is a problem elsewhere. If I'm using that for my game scripting and not necessarily pushing some modding API, is that okay? If I don't have the standard library implemented at all for general programming, is that fine? I can imagine it being a shitshow if I'm exposing file I/O calls to the entire filesystem or something.

You don’t need to foreach coroutines in unity...?

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

leper khan posted:

You don’t need to foreach coroutines in unity...?

Is there an alternative that works with .NET 2.0 outside of Unity? That was the original environment before I bumped it up to get async-await.

lethal trash
Feb 23, 2002
You will be subjected to freezing experiments in Dachau.

Rocko Bonaparte posted:

What about async/await? Is that kosher?

Async-await works on android and iOS just fine, since the release of the updated .NET for Unity the teams at the company I work at have been moving over to async-await as quickly as possible for all asynchronous methods. Generally speaking it really improves the flow of the code for asynchronous calls such as those involving HTTP requests or any of the new Addressables API. You just need to be aware of the gotchas, such as remembering to pass in cancellation tokens and setting up try-catch on all async void methods (or lose your exceptions). Unless you're porting to something obscure I'd recommend getting into using async-await and the other nice features of newer .NET.

Ruzihm
Aug 11, 2010

Group up and push mid, proletariat!


Rocko Bonaparte posted:

Every time I entered a code block that could possibly be implemented with something asynchronous, I had to wrap it in a foreach to run it out to get the result.

Rocko Bonaparte posted:

Is there an alternative that works with .NET 2.0 outside of Unity? That was the original environment before I bumped it up to get async-await.

Could you give a brief example of this? I'm not sure what you mean here, but it doesn't sound offhand like something that should be necessary.

KillHour
Oct 28, 2007


I think a foreach block implicitly wraps a try/catch? That or they wanted to handle the return value manually instead of letting unity handle it for some reason.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Ruzihm posted:

Could you give a brief example of this? I'm not sure what you mean here, but it doesn't sound offhand like something that should be necessary.

Edit: If you're just talking about the foreach syntax in play, then every time I was invoking a function call that could possibly be pre-empted, and I wanted the result, then I'd have to foreach the call to tick it out before I get the final result.

Edit edit: The more trivial blocks would look like this (from my history):
code:
foreach (var continuation in ((IPyCallable) __dict__["__call__"]).Call(interpreter, context, massagedArgs))
{
    yield return continuation;
}
...and this would be more complicated middleman logic that would get pasted around:
code:
foreach (var continuation in __new__.Call(interpreter, context, new object[] { this }))
{
    if (continuation is ReturnValue)
    {
        var asReturnValue = continuation as ReturnValue;
        self = asReturnValue.Returned as PyObject;
    }
    else
    {
        yield return continuation;
    }
}
The demo scenario I'm using is being able to run a script that does NPC dialog and prompts for selection without hanging the game to wait for it. Presumably, this could happen while allowing other scripts to keep running.

I tried to get some ideas about how to approach this from the .NET thread, but I never got much traction. Something like six months ago, there were some job postings inside my company to do some deep internal stuff in Python. Meanwhile, I wanted to do some kind of scripting for my game project, and would have preferred Python. I didn't want the calls in the scripts to block. IronPython was not set up for that and a test IronPython 3.x async branch I got much longer ago didn't help either. So I figured I'd mess around with the Python ANTLR4 grammar and make my own little thing to hopefully help me towards either a job change or an OCD hobby thing (or both).

My goal was to have something like tasklets a la Stackless Python, so I didn't want to defer to Unity's task switching for scheduling if I could help it. Also, I was developing independent of Unity even if it was my hobby target, so I didn't have StartCoroutine and things like that anyways. This is definitely overkill and for whatever little me could manage would have just been fine if I was writing this all in C# and skipping out on a scripting language.

I started with using IEnumerables and a lot of yielding. Every time I hit a spot where I could call into something that may-or-may-not wait, I'd have to make that foreach sandwich.

For what it's worth, I can do most of the basic grammar and do basic interactions with blocking calls. The bonus is that I think I can embed the REPL as a console, serialize my script state when saving, and reconnect to in-flight operations when reloading. I also know a lot more obscure Python internals trivia. On the down side, that internal hiring manager doesn't seem to care about personal projects and is looking for some Python internals PhD unicorn. All in all, it's probably only good for hitting that "working on language stuff" item on the programmer bucket list. Well, that and having a certain sense on when I should use a parser instead of piles of regular expressions whenever something like that comes up professionally.

Rocko Bonaparte fucked around with this message at 00:09 on Dec 17, 2019

LordSaturn
Aug 12, 2007

sadly unfunny

Rocko Bonaparte posted:

code:
foreach (var continuation in ((IPyCallable) __dict__["__call__"]).Call(interpreter, context, massagedArgs))
{
    yield return continuation;
}


off the top of my head, you can probably yield return the result of the function:

code:
yield return ((IPyCallable) __dict__["__call__"]).Call(interpreter, context, massagedArgs);
like, as long as .Call returns an IEnumerable, you can just hand that to the outer coroutine and it'll run once per frame until it's spent, and then the outer coroutine will continue

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

LordSaturn posted:

off the top of my head, you can probably yield return the result of the function:

code:
yield return ((IPyCallable) __dict__["__call__"]).Call(interpreter, context, massagedArgs);
like, as long as .Call returns an IEnumerable, you can just hand that to the outer coroutine and it'll run once per frame until it's spent, and then the outer coroutine will continue

Right now I think with this async-await implementation I switched to that it'll to keep it going in the same frame a little longer, but I haven't seen what happens inside Unity proper. It just looks so far like I'm able to manage all the scripts from a master scheduler, all running on the same thread.

How well would an IEnumerable approach have worked if intermediate code wanted an actual return result? There's a few situations where the script is not what is actually try to extract a result, but intermediate code using the calling API into objects to get something it needs. Granted, I am thinking I want to nuke most of that and make it illegal for my sake...

Edit: I'm not really looking for a means to revert to use IEnumerables if async-await is generally working, so nobody has to worry about it unless they really want to pick on details. I'm fine talking about that, but the details behind the switch are now getting hazy. I also feel like I kill these threads when I talk about these shenanigans. I'm probably better off doing my mad science in a project.log, but that's probably about as good as having myself on everybody's ignore list.

Rocko Bonaparte fucked around with this message at 08:06 on Dec 18, 2019

danishcake
Aug 15, 2004
I need a bit of maths advice. I have a collection of points on a sphere, and I would like to build a bounding circle on that sphere that encompasses all the points.
This is effectively building a minimum bounding circle, but on the surface of a sphere. Can anyone point me at the maths I need to go read up on?

I feel like I could do something clever with quaternions, but I can't be the first person to solve this, and I would much prefer to use someone else's solution.

e.g How do I calculate the centre and radius of the circle below, which encompasses the red points.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
It seems like Welzl's algorithm (which computes the bounding circle on a Euclidian plane) is trivially portable to your spherical scenario?

I guess the big complication with a sphere is that any circle on the surface could be drawn in two ways, but you can resolve that easily if you can constrain your points such that the true bounding circle is always less than half the sphere.

Jabor fucked around with this message at 09:23 on Dec 19, 2019

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
It occurs to me that on a sphere, finding the bounding circle is equivalent to finding the largest circle that doesn't contain any of the points, so you might be able to do better by constructing the voronoi diagram on the sphere and checking which vertex allows you to place the largest circle. Which would also work for the case where the bounding circle is larger than a single hemisphere.

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.
If you're working with a 2d projection its simply a matter of finding the mid-point of all the points, and then calculating the largest distance from that to any red point and then setting the radius to that or slightly greater than that.

But if you have to do it in 3d on the sphere it becomes more complicated, although related to the above.

Things to consider, does it have to be perfect, or just guarantee that it contains all points? Also, are the points always fairly clustered? If a point is on the other side of the sphere then the circle ends up wrapping around the sphere and poo poo gets weird.

Xerophyte
Mar 17, 2008

This space intentionally left blank

Zaphod42 posted:

If you're working with a 2d projection its simply a matter of finding the mid-point of all the points, and then calculating the largest distance from that to any red point and then setting the radius to that or slightly greater than that.

This only provides reasonable results if the points are uniformly distributed. As a counter-example: imagine you have the points roughly on the corners of a triangle. Two corners are clusters of 100 points each, and one corner is a single outlier point. The midpoint of the set is on the edge between the two clusters, but you'd want the center of the triangle for your bounding circle.

It seems to me a little dangerous to think of this as finding the minimum bounding circle, since any arbitrarily small circle on the sphere will bound all the points on one side of it. You should still be able to adapt the 2D smallest-circle algorithms if you want, but you'll probably need to be a little careful.

Another way to think of the problem is that you're looking for a cutting plane that divides your sphere into two parts: one with points and one without. You want to cut so that part with the points is as small as possible. That cut will be touching at least two of the points, possibly three. If the number of points is small (say, at most 10) you can just run the naive solution of checking all the cuts defined by point pairs and triples without it being a problem. Doing so is O(n^4) so it gets intractable pretty quick, though.

To prune the number of cuts to consider one approach I can think of is to consider the convex hull of the points. The optimal cut will be the plane of a triangle of the hull or the plane of a great circle that touches an edge on the hull. I think it will specifically be the cut that's on the edge/triangle on the hull that's closest to the center of the sphere, but I'm not 100% on that. Not sure that approach is necessarily easier though.

Linear Zoetrope
Nov 28, 2011

A hero must cook
I'm not sure this is even possible without some limitations. If you imagine the red points are on every "pole" (i.e. two for each axis, where that basis vector leaves the sphere) you've given yourself an impossible situation because you can't bound all points. If you assume they all lie on one hemisphere I'm not sure I have an algorithm, but I'm pretty sure you're essentially finding the vector such that, in spherical coordinates, the two farthest points have equal distance, and this distance is minimized. That vector is then the normal to your cutting plane, and the circle is where it intersects those extreme points on the sphere.

I'm very tired so the following may be crockery, but I think if you're guaranteed to be on a hemisphere, you can find the two farthest points from each other in quaternion/rotational distance, and then choose the normal to the line between them that also points outward from the center of the sphere. The rub then is finding the largest distance which can be done in O(n^2) but probably has some better way I'm blanking on, I don't think most nearest neighbor family algorithms are well equipped to handle farthest distance out of the box, but most can be modified to handle it (I think there's a paper on doing it with R-trees). For a Small Enough™ collection of points, it's probably faster to brute force than build the tree and do farthest neighbor queries anyway.

Linear Zoetrope fucked around with this message at 14:55 on Dec 19, 2019

Dr. Stab
Sep 12, 2010
👨🏻‍⚕️🩺🔪🙀😱🙀
E:nvm

Xerophyte
Mar 17, 2008

This space intentionally left blank

Linear Zoetrope posted:

I'm not sure this is even possible without some limitations. If you imagine the red points are on every "pole" (i.e. two for each axis, where that basis vector leaves the sphere) you've given yourself an impossible situation because you can't bound all points.

It's possible even in this scenario, any circle that has all of the poles on the outside will be a "bound" of sorts. You can't really talk about the smallest one, since you can make the circle arbitrarily small and it'll still be a valid cut. For the not-on-a-hemisphere case you're looking to construct the largest circle you can with the same properties.

Thinking on it a little more I think you can view the problem as finding the point on the convex hull of points that's closest to the center of the sphere. If the closest point is on an edge then the best cut is a great circle connecting the two points connected by that edge. If the closest point is on a polygon then the best cut is the plane of the polygon. I suspect that you can go from computing the entire hull to instead randomly sample point triples and accept them they provide a new closest point to the center until you've found the optimum, which is an adapted Welzl's algorithm.

ButtWolf
Dec 30, 2004

by Jeffrey of YOSPOS
Unity question: I am making a page to view pieces of lore.Right now this system (not locked into this), is an array of bools with true if that piece has been unlocked. fine. each piece of lore has a text file and clicking a button to display it in a text box is fine and easy, but is there a way that I can get an array of strings (each entry name) as a list of buttons on a scrollable side panel type thing in a script? I'd then need to pass the name on the button to the loader script. I haven't really worked with UI/Canvas before. Thank you.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
Make a prefab with an attached script that knows where the text, button, etc are. Hand the prefab to another script, and have it instantiate the prefab once per bit of lore.

Raenir Salazar
Nov 5, 2010

College Slice
Anyone in the Blender to Unity3D/Unreal workflow pipeline have any suggestions for lipsync'ing a character model? I'm using Rigify (I paid for Autorig pro but it had too many issues) and it seems like animating any kind of dialogue by hand will get tedious fast.

I could just not bother and save a lot of time but I am at least curious about the process.

Adbot
ADBOT LOVES YOU

Synthbuttrange
May 6, 2007

There's an addon called Rhubarb that does automated morph lipsyncing.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply