POV-Ray : Newsgroups : povray.general : Problems performing trace() on object : Problems performing trace() on object Server Time
2 Aug 2024 08:15:02 EDT (-0400)
  Problems performing trace() on object  
From: Mike Thorn
Date: 11 Dec 2004 20:07:39
Message: <41bb99db@news.povray.org>
I know lots of you have used trace() quite recently, so I hope you'll be 
able to help me out here. :)

I have a heightfield. A big one. As in, 600x500. I want to place battle 
droids (similar to the one I posted in p.b.i earlier this week) on it. 
It would be nice to spread them out over about half of it in on the 
z-axis, if that's even possible, (but I thought I heard somewhere that 
it's not) but most importantly I just want them spread over the width of 
the entire field.

So I'm using trace() to position them randomly at the proper height. 
That works. Very well, in fact. However, they only get spread over about 
an eighth of the image - halfway across and about a quarter way down.

Here's the slightly modified code I copied from Gilles' xfrog tree 
conversion page ("battlefield" is the heightfield and "droid+gun.pov" is 
the file which contains the droid object definition. "Inter+y*19" is 
necessary to raise the droid to the proper height above the field):

   #include "droid+gun.pov"
   #declare i=1;
   #declare rd=seed(2);
   #while (i < 25) // loop 49 droids
     #declare Norm=<0,0,0>;
     #declare Start = x*(-300*rand(rd)) + z*(250*rand(rd));
     #declare Inter= trace ( battlefield, Start, y, Norm );
     #if (vlength(Norm)>0) // If Norm = <0,0,0> no intersection is found
       object{droid rotate y*1*rand(rd) translate Inter+y*19}
     #end
     #declare i=i+1;
   #end

Is there a reason obvious to anyone why it's doing this? I can provide 
the render if necessary.

Thanks,

~Mike


Post a reply to this message

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