Volume

Hey,
I would like to randomly distribute objects in a spherical volume defined by a radius, how would I do that?
Cheers

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

Hi Br0t

I think you need random radius and angle rotation.
Pseudo code (not tetsed):

thePivot = [0,0,150]
theRadius = 300
 
for i = 1 to 100 do (
	r = random 0 theRadius
	p = Point pos:[0,0,r]
	about thePivot (
		rotate p (random -90 90) x_azis
		rotate p (random -90 90) y_azis
		rotate p (random -90 90) z_azis
	)
)

Let me know is this helps at all ;)

Hmm... or maybe the next is better?...

thePivot = [0,0,150]
theRadius = 300
p = undefined
 
for i = 1 to 100 do (
	r = random 0 theRadius
	in coordsys thePivot (p = Point pos:[0,0,r])
	about thePivot (
		rotate p (random -90 90) x_azis
		rotate p (random -90 90) y_azis
		rotate p (random -90 90) z_azis
	)
)

my recent MAXScripts RSS (archive here)

miauu's picture

You can check RTTAssist sours

You can check RTTAssist sours code. I'v developed the explode function that explode objects in a spherical volume, but not randomly. May be you can modify the code to fit your needs. :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.