Gem Placement on Static Mesh

Blitz3D Forums/Blitz3D Beginners Area/Gem Placement on Static Mesh

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Set the static mesh to be pickable - entitypickmode 2 then use linepicks.

Assuming the mesh is 200x200 units square and the maximum height of the mesh is 100 units ..


gem = loadmesh("mygem")

for l = 1 to 100 

  x# = rand(-100,100 )  
  z# = rand(-100,100 )
  copy = copyentity( gem )

  linepick x, 110, z, 0,-120,0
  positionentity copy, x,pickedy()+1, z

next




You may want to add in checks to make sure there aren't 2 gems at the same point.

If you need the gem to align to the landscape you could use ...

aligntovector pickednx(), pickedny(), pickednz(), 2

after positioning.

Stevie