Rather basic.
Code: Select all
Define.l NumObj=10
Dim prop.POS(NumObj)
Define.l PlaneNum
CreateMaterial(#Material0, LoadTexture(#Texture0, "RustySteel.jpg"))
;SkyBox("stevecube.jpg")
For i=1 To NumObj
prop(i)\X = Random(150, 0)
prop(i)\Y= Random(150, 0)
prop(i)\Z = Random(150, 0)
prop(i)\meshnum = CreateSphere(#PB_Any, 10, 50, 50)
prop(i)\entnum = CreateEntity(#PB_Any,MeshID(prop(i)\meshnum), MaterialID(#Material0), prop(i)\X-75, prop(i)\Y-75, -prop(i)\Z)
;EntityPhysicBody(prop(i)\entnum, #PB_Entity_StaticBody, 1)
EntityPhysicBody(prop(i)\entnum, #PB_Entity_SphereBody, 1)
Next
Code: Select all
#Max = 2147483647
Structure POS
X.l
Y.l
Z.l
EndStructure
Define.l NumObj=10
Dim prop.POS(NumObj)
Define.l a
Define.f out1, out2
Define.l seed
seed = Random(#Max)
RandomSeed(seed)
For i=1 To 10
prop(i)\X = Random(150, 0)
prop(i)\Y = Random(150, 0)
prop(i)\Z = Random(150, 0)
a=1
While a < i
out1 = Sqr((Pow((prop(a)\X - prop(i)\X), 2.0) + Pow((prop(a)\Y - prop(i)\Y), 2.0) + Pow((prop(a)\Z - prop(i)\Z), 2.0)))
If out1 < 100
Repeat
Debug "REPEAT"
prop(a)\X = Random(150, 0)
prop(a)\Y= Random(150, 0)
prop(a)\Z = Random(150, 0)
out2 = Sqr((Pow((prop(a)\X - prop(i)\X), 2.0) + Pow((prop(a)\Y - prop(i)\Y), 2.0) + Pow((prop(a)\Z - prop(i)\Z), 2.0)))
Until out2 > 100
Debug out1
Debug out2
;a = 1 ;??
Else
a = a + 1
EndIf
Wend
Next
Thanks.