FYI, What are the forum codes?
You just didn't have your linepick command set up correctly. That's the only line I changed.
Since your cubes are at Z position -.25, I set the line pick to check from -1 to 0.
I also set it to have a radius of .05 to account for the radius of the sphere.
This basically works.
However, it doesn't take into account the fact that one of the cubes is rotating.
An easy fix for that could be to place a sphere/cylinder with the same radius as the cube at the rotating cubes position (with the same entitytype) while placing the small spheres, and then erase it later.
You just didn't have your linepick command set up correctly. That's the only line I changed.
Since your cubes are at Z position -.25, I set the line pick to check from -1 to 0.
I also set it to have a radius of .05 to account for the radius of the sphere.
Function createxCibles(nb%) Local e For i%=0 To nb% k% = 0 c.TCible = New TCible c\typ% = typ% c\entite = CreateSphere(16) ScaleEntity c\entite,.05,.05,.05 EntityType c\entite,TYPE_CIBLE EntityColor c\entite,100,100,180 EntityRadius c\entite,.05 NameEntity c\entite,Handle(c) Repeat ; e = 0 c\x# = Rnd(-2,2) c\y# = Rnd(-2,2) ; e = LinePick(c\x#, c\y#, -1, 0, 0, 1, .05) If e <> 0 Then DebugLog("move !!!" + k%) k% = k% + 1 EndIf Until (e = 0) PositionEntity c\entite,c\x#,c\y#,-.5 Next End Function
This basically works.
However, it doesn't take into account the fact that one of the cubes is rotating.
An easy fix for that could be to place a sphere/cylinder with the same radius as the cube at the rotating cubes position (with the same entitytype) while placing the small spheres, and then erase it later.