Get Random Positions On A Plane
1686 Views
-
#Generate an array of random non-repeating positions in the same plane(Vertical) #<param name="startPos">Start position of the plane</param> #<param name="endPos">End position of the plane</param> #<param name="size">The spatial size of each object</param> #<param name="num">Number of positions to get</param> GetRandomPosInPlaneVertical(startPos: vector3 , endPos:vector3 , size:vector3, num: int ): []vector3= #First, cut the plane into 'n' cells according to the size of the object. var sizePos :vector3= endPos - startPos; var maxNum: int = 0 var y:int = 0; var z:int = 0; if: tmpY:int = Int[sizePos.Y / size.Y] tmpZ:int = Int[sizePos.Z / size.Z] then: set maxNum = tmpY * tmpZ; set y = tmpY set z = tmpZ #Arrange these cells into an array by serial number. var allList: []int = for (i:= 1..maxNum): i
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.