POV-Ray : Newsgroups : povray.advanced-users : Collision Detection : Re: Collision Detection Server Time
29 Jul 2024 10:25:15 EDT (-0400)
  Re: Collision Detection  
From: hughes b
Date: 3 Aug 2002 10:33:32
Message: <3d4be9bc@news.povray.org>
Hey there, here is what I managed to do with it and maybe you'll see the
things different from your way. I think the main problem was to get the
trace all done in the positive y instead of dealing with negative. Just not
sure that was the real factor causing the trouble. I was only able to get it
set right using <0,0,0> to <X,+Y,0>.

Anyway, the incurable problem seems to be about the gaps between the
spheres. That isn't solvable by just tracing alone, my usual answer would be
to spline it together using only selected trace points to skip the gaps. Not
very ingenious, admittedly, but only way I know of.

Makes it impossible to just trace the surfaces everywhere along the path
when those gaps are obviously also a part of the surface. However, if you
check the changed script below you'll see that the wheel at least follows
along the tops of the spheres.

Maybe Rune or someone else with mastery of this kind of stuff will have some
tips.

#version 3.5;

#include "colors.inc"

global_settings {
  assumed_gamma 1.0
}

camera {
  location  <0.0, 1.5, -4.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}

// ----------------------------------------
#declare Ground =
  plane { y, 0 } // everything is moved up 1*y from before

#declare Wheel=
  sphere {<0,.25,0>,.25}

#declare Rock=
  union
    {
    sphere {<-1,0,0>,.5}
    sphere {<0,0,0>,.7}
    sphere {<1,0,0>,.5}
    }

#macro MoveWheel()

  #declare height=1;

  #declare initLoc=<-2+clock*4,height,0>; // combined to vector

  #declare Norm=<0,0,0>;

  #declare intersect=trace(Rock,initLoc, <0,0,0>-initLoc, Norm);

  #debug concat("intersect: <",vstr(3,intersect,",",4,3))
  #debug concat("> norm:<",vstr(3,Norm,",",4,3),"> "," initLoc = ")
  #debug concat(str(initLoc.x,3,1),"\n")

  #if (vlength(Norm)!=0)

  #declare Direction=Norm;

  pigment{checker color rgb<0,0,1> color rgb<0,1,0>
         scale 0.25
         rotate 90*Direction // I have no idea what I did here :-)
          }

  translate intersect

  #end

#end


object {Ground pigment { color rgb <0.7,0.5,0.3> }}
object {Rock pigment{color rgbf<1,0,0,0>}}

object
  {
  Wheel
  MoveWheel()
  }


Post a reply to this message

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