New answers tagged

0

One optimization pops into my head. Don't use 2D arrays. You can do JUST fine on 1D array, also you can remove one for loop from it, in the long run improve cache hit ratio, making your code possibly faster. What I mean is this: public void SwapSelected(Tile tileToSwap, uint Width) { Vector3 tempPos = selectedTile.transform.position; selectedTile....


2

For anyone in the future looking for a solution to this using Unity/C#, here is an implementation I made based on Steve's answer: //takes a rotation and returns the rotation that is the closest with all axes pointing at 90 degree intervals to the identity quaternion Quaternion snapToNearestRightAngle(Quaternion currentRotation) { Vector3 ...


Top 50 recent answers are included