Maths - cube entitys in a circle?

Blitz3D Forums/Blitz3D Programming/Maths - cube entitys in a circle?

IPete2(Posted 2007) [#1]
Hiya,

Can anyone help please? No movement required, just placement in a semi-spherical shape to be like a stardome.

I want to place 50 cube entitys as 'stars' in a semisphere shape using code (i.e. b3d cubes), so as my character runs about you can see small cube entitys in the sky like they are stars. Anyone got any ideas maths wise please?

Many thanks

IPete2.


Stevie G(Posted 2007) [#2]
Like this?

Graphics3D 640,480,16,1

Global CamPiv = CreatePivot()
Global Camera = CreateCamera( CamPiv ) : PositionEntity Camera, 0,0,-100 
Global Dome = CreateSphere() : ScaleMesh Dome, 50,50,50 : FlipMesh Dome : EntityColor Dome, 64,64,128
Const DomeRadius = 50

;place stars
Star = CreateCube() : ScaleMesh Star, .25,.25,.25
For l = 1 To 150
	tmp = CopyEntity( Star )
	RotateEntity tmp, Rand(-80,-10), Rand(-180,180) , 0
	MoveEntity tmp, 0,0,DomeRadius-1
Next
FreeEntity Star


While Not KeyDown(1)

	TurnEntity CamPiv, 0,1,0

	RenderWorld()
	Flip

Wend



IPete2(Posted 2007) [#3]
Thanks Stevie,

I have used a sort of cos/sin formula at the moemnt but
I shall check yours out and use the one that best fits my needs if that's ok!

Thanks!

IPete2.