3

After getting help from @DMGregory I was able to solve this by : Getting the center of the toppingsA and toppingsB Finding 6 most far toppings from the centers generate 2 polygons based on these 6 vertices for each topping check if polygons have the minumum area needed to cover most of the half and that they don't collide This gives accurate half-half ...


2

I tried it out in the Online Encyclopedia of Integer Sequences and found this one for the top half of the diamond: i = floor((-1 + sqrt(1+4*number))/2) The bottom half just needs to be reversed, like you’ve already done when going the other way.


2

Presumably you considered just converting your angle and distance from polar coordinates into a Cartesian vector in the usual way? public static Vector3 FromPolar(float angleRadians, float radius) { return new Vector3(Mathf.Sin(angleRadians), 0 Mathf.Cos(angleRadians)) * radius; } You can now add that offset to the player position to spawn the building ...


1

Your solution might work with a world-space canvas, but I don't recommend using world-space canvases for most situations because it's difficult to make them adapt to different screen aspect ratios/resolutions. If you're using a Screen Space canvas, you need to convert the world coordinates of the sprite renderers into screen space, then convert that into ...


1

This is probably not the best solution in terms of performance but the easiest thing you could do (and this may be okay if you limit the number of toppings) would be to iterate though all topping positions and check the angles between them (you can find someone looking for a similar solution here) This would require iteration through an array while in array ...


1

Adding the dragged actor's parent coordinate values to the actor's values did the trick: Vector2 snapShot = new Vector2(a.getParent().getX() + a.getX(), a.getParent().getY() + a.getY()) ; other.getParent().addActor(a); a.setBounds(snapShot.x, snapShot.y, a.getWidth(), a.getHeight());


1

Thanx DMGregory for taking part. I found a decision to this problem. In the saving capture screen part must be added a few rows: RenderTexture rt = new RenderTexture(ImageWidth, ImageHeight, 24); detector.targetTexture = rt; Texture2D screenShot = new Texture2D(ImageWidth, ImageHeight, TextureFormat.RGB24, false); float aspect = ...


1

After some experiments, I figured this out, and as was noticed in the comments to my question it was not to do with my matrix multiplication order, but rather something else entirely. After calculating the world transform of my object, I decomposed it into a vec3 translation, vec3 scale and quat rotation. This operation stripped out what is effectively a ...


1

First, we divide the x, y, and z coordinates into unit cubes. In other words, find [x,y,z] % 1.0 to find the coordinate's location within the cube. What that means is you perform the value % 1.0 operation for each member of the [x,y,z] vector (the position): [x', y', z'] = [x % 1.0, y % 1.0, z % 1.0] x', y', and z' are the remainders of dividing each ...


Only top voted, non community-wiki answers of a minimum length are eligible