POV-Ray : Newsgroups : povray.animations : Please HELP! Walking problem. Server Time
28 Jul 2024 22:16:28 EDT (-0400)
  Please HELP! Walking problem. (Message 1 to 1 of 1)  
From: Jay
Subject: Please HELP! Walking problem.
Date: 10 Jul 1998 14:14:40
Message: <35a649e4.70071429@news.povray.org>
Hello all.  I'm trying to get an object to do a sort of walk/waddle sort of
thing.  I'm having major problems with it.  Specifically, it's jumping all over
the place.  Right now, I haven't even implimented the moving forward part,
because I can't even get the rotating motion right.  I'd greatly appriciate some
help.  Here's my latest attempt at making this thing work.  The clock is set to
run from 0-5.

Thanks
Jay


#include "colors.inc"
#include "textures.inc"

camera
{
  location  <0.0 , 5.0 ,-9.0>
  look_at   <0.0 , 0.0 , -4.0>
}

light_source
{
  0*x
  color red 1.0  green 1.0  blue 1.0
  translate <-20, 40, -20>
}

#declare NumSteps=5
#declare WalkAngle=45   // change this to change the length of the stride
#declare W_Angle=0      // don't change this
#declare RotateFrom=1   // This is how far from the center the object rotates on
each step
#declare Steps=0
#declare UpAngle=15
#declare StepClock=-1
#declare StartZ=0
#declare CumulativeZ=0




plane { y, 0 pigment { checker color Blue color Green } }

cylinder { <0, 0, -100> <0, 0, 100> .05 pigment { Yellow} }

#declare Walker =
union {
  box { <-1, 1, -.25> <1, 1.2, .25> pigment { Red } }
  cylinder { <0, 0, 0> <0, .99, 0> .25 translate -x*.75 pigment { Orange } }
  cylinder { <0, 0, 0> <0, .99, 0> .25 translate x*.75 pigment { Orange } }
}

  #if ( mod(int(clock),2) = 0 )
    
    #if (W_Angle < WalkAngle)
      #declare StepClock=(2*(clock-Steps)-1)
      #declare W_Angle=(WalkAngle*StepClock)
      object { Walker translate x*RotateFrom
               rotate <0, W_Angle, 0>
               translate <-RotateFrom, 0, 0> }
    #end
    #declare Steps=(Steps+1)
    #declare W_Angle = 0
  #else
    #if (W_Angle < WalkAngle)
      #declare StepClock=(2*(clock-Steps)-1)
      #declare W_Angle=(WalkAngle*StepClock+90)
      object { Walker translate -x*RotateFrom
               rotate <0, -W_Angle, 0>
               translate < RotateFrom, 0, 0> }
    #end
    #declare Steps=(Steps+1)
    #declare W_Angle = 0
  #end


Post a reply to this message

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