POV-Ray : Newsgroups : povray.advanced-users : Random placement of objects : Random placement of objects Server Time
26 Jun 2024 05:25:02 EDT (-0400)
  Random placement of objects  
From: Bald Eagle
Date: 29 Aug 2013 08:15:00
Message: <web.521f3ad329e33e34dd2ebc560@news.povray.org>
I'd like to place some objects semi-randomly in a scene.
Semi, because they should not intersect or overlap other stationary objects.

It seems to me that this ought to be a classic issue in video games, and one
that's been long solved, and I will research it further.
I do however have limited time, and if someone can nudge me over to a quick
resolution of the problem, that would be great.

Basically I want to take some short strings and have them fade in and out of the
"open areas" in the visible area of the scene.

I could also use a primer and straightening out of my understanding of how the
pseudo-random streams work, since when I run my little test scene with a box and
a string, the string is always in the same place.  What's the solution /
workaround?

#declare Message = text { ttf "arial.ttf" Attributes [2] 0.1, 0 pigment {White}
scale 1 translate < rand(FlashX), rand(FlashY), rand(FlashZ) > * 4}
#declare MinM = min_extent(Message);
#declare MaxM = max_extent(Message);


object {Avoid}
object {Message}

#if (MaxM.x > MinA.x | MinM.x < MaxA.x)
text { ttf "arial.ttf" "X Overlap" 0.01, 0 pigment {Red} translate y*1}
#end

#if (MaxM.y > MinA.y | MinM.y < MaxA.y)
text { ttf "arial.ttf" "Y Overlap" 0.01, 0 pigment {Red} translate y*0}
#end

#if (MaxM.z > MinA.z | MinM.z < MaxA.z)
text { ttf "arial.ttf" "Z Overlap" 0.01, 0 pigment {Red} translate -y*1}
#end


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.