Check my math...?

Yes i know this script is a mess but it’s my first time trying mesh generation via code. The code returns no error so it has to be a math error

Here is the line that contains the math i wasn’t sure how to contain the order of operations so this is how i typed it and it returns (0, 0, 0) when it is suppose to be (-5, -0, 5)

float maxRoomSize = 100;

vertices [1] = new Vector3 (-1 * 1 / 2 * Mathf.Sqrt (maxRoomSize), 0, 1 / 2 * Mathf.Sqrt (maxRoomSize));

//Square root of 100 is 10

//10 * 1/2 = 5

//5 * -1 = -5 why is it 0?

I’m almost positive its an order of operations error but i’ll let someone else judge that

You’re suffering from integer division… try changing 2 to 2f and it’ll work.