POV-Ray : Newsgroups : povray.animations : Animating Lego Garage door Server Time
23 Nov 2024 05:25:29 EST (-0500)
  Animating Lego Garage door (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Thomas
Subject: Animating Lego Garage door
Date: 11 Jun 2012 16:55:01
Message: <web.4fd65ad8e7ec90d9a6b6bd7e0@news.povray.org>
Hi,

Years ago I started modelling a Lego fire station (set 6382) with Anton Raves
Lego library. It has two sliding garage doors (have a google for the set). I
recently returned to this model and wondered how I could make a macro that would
allow me to control the garage door with a single parameter. I played around
with it a bit and I managed to get the lower bit that just slides up and down.
Based on a clock from 0 (closed) to 1 (open).

What I am struggling with is the bit where the shutter has to rotate and follow
the groove. Any ideas how this can be achieved?

TIA

Thomas

Here is a cut down version that gives an orthographic view of the problem from
the side:


// render with +KFI0 -KFF100

background { color rgb .75}

// pieces used by animation

#declare shutter =
difference {
  merge {
    cylinder { -33.9*x, -30*x, 1.5 pigment {color rgb <0,0,1> } finish {ambient
1}}
    cylinder { 30*x, 33.9*x, 1.5 pigment {color rgb <0,0,1>} finish {ambient 1}}
    sphere { <-30.5, 0, 0> 1 }
    sphere { <30.5, 0, 0> 1 }
    box { <-32, -6.1, -0.9> <-30, 0, 0.9> }
    box { <30, -6.1, -0.9> <32, 0, 0.9> }
    box { <-30.000001, -8.700001, -0.900001> <30.000001, -1.9, 0.900001> }
    cylinder { -30.000002*x, 30.000002*x, 0.9 translate <0, -8.7, 0> }
  }
  sphere { <-30.5, -8.7, 0> 1.1 }
  sphere { <30.5, -8.7, 0> 1.1 }
  box { <-28.8, -8.7, -1> <-15.1, -2.9, -0.3> }
  box { <-14.1, -8.7, -1> <-0.5, -2.9, -0.3> }
  box { <28.8, -8.7, -1> <15.1, -2.9, -0.3> }
  box { <14.1, -8.7, -1> <0.5, -2.9, -0.3> }
  bounded_by { box { <-34, -9.7, -1.6> <34, 1.6, 1.6> } }
pigment {color rgb <1,0,0>} finish {ambient 1}
}

#declare shutter_with_handle =
difference {
  merge {
    cylinder { -33.9*x, -30*x, 1.5 pigment {color rgb <0,0,1> } finish {ambient
1}}
    cylinder { 30*x, 33.9*x, 1.5 pigment {color rgb <0,0,1> } finish {ambient
1}}
    cylinder { -33.9*x, -30*x, 1.5 translate <0, -8.1, 0> }
    cylinder { 30*x, 33.9*x, 1.5 translate <0, -8.1, 0> }
    sphere { <-30.5, 0, 0> 1 }
    sphere { <30.5, 0, 0> 1 }
    box { <-32, -6.1, -0.9> <-30, 0, 0.9> }
    box { <30, -6.1, -0.9> <32, 0, 0.9> }
    box { <-32.000001, -8.700001, -0.900001> <32.000001, -1.9, 0.900001> }
    cylinder { -32.000002*x, 32.000002*x, 0.9 translate <0, -8.7, 0> }
    difference {
      cylinder { -2.4*z, 2.4*z, 2.3 }
      box { <-3, 0.9, -3> <3, 5, 3> }
      box { <-3, -5, -3> <3, -0.9, 3> }
      translate <0, -4.5, 0>
    }
  }
  box { <-28.8, -8.7, -1> <-15.1, -2.9, -0.3> }
  box { <-14.1, -8.7, -1> <-0.5, -2.9, -0.3> }
  box { <28.8, -8.7, -1> <15.1, -2.9, -0.3> }
  box { <14.1, -8.7, -1> <0.5, -2.9, -0.3> }
  bounded_by { box { <-34, -9.7, -2.5> <34, 1.6, 2.5> } }
  pigment {color rgb <1,0,0>} finish {ambient 1}
}

//The guiding blocks
#macro guiding_h_block1_14()
merge {
  difference {
    box { <-3.9, 0, -3.9> <107.9, 9.5, 3.9> }
    difference {
      box { <-2.4, -1, -2.4> <106.4, 8.6, 2.4> }
      #declare counter = 0;
      #while (counter < 13)
        cylinder { -2*y, 9*y, 1.5 translate <(counter*8)+4, 0, 0> }
      #declare counter = counter + 1;
      #end
      box { <4, 4, -4> <100, 10, -1> }
      difference {
        box { <0.1, -2, -2.4> <7.9, 11, 0> }
        cylinder { -1*y, 9*y, 2.4 translate <0.1, 0, 0> }
        cylinder { -1*y, 9*y, 2.4 translate <7.9, 0, 0> }
      }
      difference {
        box { <0.1, -2, -2.4> <7.9, 11, 0> }
        cylinder { -1*y, 9*y, 2.4 translate <0.1, 0, 0> }
        cylinder { -1*y, 9*y, 2.4 translate <7.9, 0, 0> }
        translate <96, 0, 0>
      }
    }
    box { <2.25, -1, -4> <5.75, 3.500001, -1.9> pigment {color rgb 1 } finish
{ambient 1} }
    box { <98.25, -1, -4> <101.75, 3.500001, -1.9> pigment {color rgb 1 } finish
{ambient 1} }
    box { <7.249999, 4.999999, -4> <96.750001, 8.499999, -1.900001> pigment
{color rgb 1 } finish {ambient 1}}
    intersection {
      difference {
        cylinder { -4*z, -1.900002*z, 5 }
        cylinder { -5*z, 0*z, 1.5  }
      }
      box { <-10, 0, -5> <0, 10, 0> }
      translate <7.25, 3.5, 0>
    }
    intersection {
      difference {
        cylinder { -4*z, -1.900002*z, 5 pigment {color rgb 1 } finish {ambient
1} }
        cylinder { -5*z, 0*z, 1.5  }
      }
      box { <0, 0, -5> <10, 10, 0> }
      translate <96.75, 3.5, 0>
    }
  }
  #declare counter = 0;
  #while (counter < 14)
    difference {
      cylinder { 9.4*y, 11.2*y, 2.3 }
      cylinder { 9*y, 12*y, 1.6 }
      translate <(counter*8), 0, 0>
    }
  #declare counter = counter + 1;
  #end
  pigment {color rgb <0,0,0>} finish {ambient 1}
  bounded_by { box { <-4, -0.1, -4> <108, 11.3, 4> } }
}
#end

#macro guiding_h_block1_2()
merge {
  difference {
    merge {
      box { <-3.9, 0, -3.9> <11.9, 9.5, 3.9> }
      cylinder { 9.4*y, 11.2*y, 2.3 }
      cylinder { 9.4*y, 11.2*y, 2.3 translate <8, 0, 0> }
    }
    box { <2.2, -1, -4> <5.8, 10, -1.9> pigment {color rgb 1 } finish {ambient
1}}
    cylinder { -1*y, 8.6*y, 2.4 }
    cylinder { -1*y, 8.6*y, 2.4 translate <8, 0, 0> }
    box { <-2.4, -1, 2.4> <10.4, 8.6, 0>  }
    box { <-2.4, -1, -2.4> <0, 8.6, 0> }
    box { <8, -1, -2.4> <10.4, 8.6, 0> }
    cylinder { 7.4*y, 10.4*y, 1.2 }
    cylinder { 7.4*y, 10.4*y, 1.2 translate <8, 0, 0> }
  }
  cylinder { 0*y, 8.7*y, 1.5 translate <4, 0, 0> }
  pigment {color rgb <0,0,0>} finish {ambient 1}
  bounded_by { box { <-4, -0.1, -4> <12, 11.3, 4> } }
}
#end



/*****************************************************************/
/*
camera {
  location  <0, 32*8, 24>
  direction 2*z
  up        y
  right     4/3*x
  look_at   <0, 5*8, 24>
} */

camera {
  orthographic
  location <0*8, 5*9.6, -40*8>
  right <15*4/3*8, 0, 0>      // length determines size of view
  up <0, 15*8, 0>             // length determines size of view
  direction <0, 0, 1>              // length isn't used
  look_at <0*8, 5*9.6,0*8 >
}


/****************************************************************/

#macro ShutterBottomPart(Opened)
union
{
    #declare Counter = 0;
    #declare NumberOfShutters= ceil((.9-Opened)*10);
    #if (Opened <0.9)
        #while ( Counter < NumberOfShutters)
            #if ( Counter = 0)
                object {shutter_with_handle translate <0, Counter*8+8,0> }
            #else
                object {shutter translate <0, Counter*8+8,0> }
            #end
            #declare Counter = Counter + 1;
        #end
    #end
}
#end


object {ShutterBottomPart(clock) rotate -90*y translate <0,clock*83.55,0>}


object {guiding_h_block1_2() translate <-4,0,6*8> }
object {guiding_h_block1_2() translate <-4,9.6,6*8> }
object {guiding_h_block1_2() translate <-4,2*9.6,6*8> }
object {guiding_h_block1_2() translate <-4,3*9.6,6*8> }
object {guiding_h_block1_2() translate <-4,4*9.6,6*8> }
object {guiding_h_block1_2() translate <-4,5*9.6,6*8> }
object {guiding_h_block1_2() translate <-4,6*9.6,6*8> }
object {guiding_h_block1_2() translate <-4,7*9.6,6*8> }
object {guiding_h_block1_14() translate <-4-12*8,8*9.6,6*8> }


Post a reply to this message

From: Stephen
Subject: Re: Animating Lego Garage door
Date: 11 Jun 2012 17:39:46
Message: <4fd665a2@news.povray.org>
On 11/06/2012 9:53 PM, Thomas wrote:
> What I am struggling with is the bit where the shutter has to rotate and follow
> the groove. Any ideas how this can be achieved?

Hi Thomas, I have not looked at your code but I have an idea that you 
might be able to adapt.
Some years ago I did something similar for a TC-RTC animation. I used 
splines to control the motion. In the animation below (it is cyclic and 
should be viewed as a loop) each row is unioned (if that is a word). The 
unions can be translated then rotated. This should give you the motion 
required.

http://youtu.be/7BmtOe-8n0E

-- 
Regards
     Stephen


Post a reply to this message

From: Thomas
Subject: Re: Animating Lego Garage door
Date: 12 Jun 2012 05:55:01
Message: <web.4fd710e3531db36444c4f2480@news.povray.org>
Stephen <mcavoys_at@aoldotcom> wrote:
> Some years ago I did something similar for a TC-RTC animation. I used
> splines to control the motion. In the animation below (it is cyclic and

I hadn't thought about using a spline for this... but that indeed might do the
trick. I'll give it a try (if I can find some time).

Thanks for the idea.

Thomas


Post a reply to this message

From: Stephen
Subject: Re: Animating Lego Garage door
Date: 12 Jun 2012 06:21:09
Message: <4fd71815$1@news.povray.org>
On 12/06/2012 10:50 AM, Thomas wrote:
> Stephen<mcavoys_at@aoldotcom>  wrote:
>> Some years ago I did something similar for a TC-RTC animation. I used
>> splines to control the motion. In the animation below (it is cyclic and
>
> I hadn't thought about using a spline for this... but that indeed might do the
> trick. I'll give it a try (if I can find some time).
>
> Thanks for the idea.
>

My pleasure and remember that you can store the data in an array.

-- 
Regards
     Stephen


Post a reply to this message

From: Thomas
Subject: Re: Animating Lego Garage door
Date: 8 Jul 2012 15:20:01
Message: <web.4ff9dc6f531db36413782c460@news.povray.org>
I finally managed to get something going that I like. There are still a few
little bugs in and I am not convinced the bottom part should move like it does
now. Surely it should move at the same speed that the top part is moving at?


Here is the link:
http://legopov.blogspot.co.uk/

Thomas


Post a reply to this message

From: Stephen
Subject: Re: Animating Lego Garage door
Date: 8 Jul 2012 15:59:29
Message: <4ff9e6a1$1@news.povray.org>
On 08/07/2012 8:16 PM, Thomas wrote:
> I finally managed to get something going that I like. There are still a few
> little bugs in and I am not convinced the bottom part should move like it does
> now. Surely it should move at the same speed that the top part is moving at?
>
>
> Here is the link:
> http://legopov.blogspot.co.uk/
>

That is good.
I think that it needs some more fps to see it better and a higher 

bothering you with the movement of the bottom part.

edge rises unevenly as it rotates. I say unevenly but I think that it 
will be a sine function.
You could post a mpg in povray.binaries.animations.



-- 
Regards
     Stephen


Post a reply to this message

From: clipka
Subject: Re: Animating Lego Garage door
Date: 8 Jul 2012 21:36:39
Message: <4ffa35a7$1@news.povray.org>
Am 08.07.2012 21:16, schrieb Thomas:
> I finally managed to get something going that I like. There are still a few
> little bugs in and I am not convinced the bottom part should move like it does
> now. Surely it should move at the same speed that the top part is moving at?
>
>
> Here is the link:
> http://legopov.blogspot.co.uk/

There's something fishy indeed: The elements seem to grow and shrink as 
they pass the curve.


Post a reply to this message

From: Thomas
Subject: Re: Animating Lego Garage door
Date: 9 Jul 2012 16:00:01
Message: <web.4ffb3742531db36413782c460@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 08.07.2012 21:16, schrieb Thomas:
> > I finally managed to get something going that I like. There are still a few
> > little bugs in and I am not convinced the bottom part should move like it does
> > now. Surely it should move at the same speed that the top part is moving at?
> >
> >
> > Here is the link:
> > http://legopov.blogspot.co.uk/
>
> There's something fishy indeed: The elements seem to grow and shrink as
> they pass the curve.

hi,

I posted a new animation in povray.animations.binary (?) after I fixed a few
bugs last night. It is also a render where the see through parts aren't see
through as it is a significant speed up :)

Any comments welcome.

Thomas


Post a reply to this message

From: Le Forgeron
Subject: Re: Animating Lego Garage door
Date: 9 Jul 2012 16:10:29
Message: <4ffb3ab5$1@news.povray.org>
Le 09/07/2012 21:55, Thomas nous fit lire :
> Any comments welcome.

Awesome.

Yet, the right angle would actually kind of make it impossible to move
that door the usual way. I guess it's just the original design of Lego.

(a slanted section at 45°, however small as long as probably larger than
1 element, would really be helpful to open & close the door from a
single point of action)


Post a reply to this message

From: Stephen
Subject: Re: Animating Lego Garage door
Date: 9 Jul 2012 17:44:16
Message: <4ffb50b0$1@news.povray.org>
On 09/07/2012 8:55 PM, Thomas wrote:
> I posted a new animation in povray.animations.binary (?) after I fixed a few
> bugs last night. It is also a render where the see through parts aren't see
> through as it is a significant speed up:)

It looks good to me. I think you've got it. Well done!

-- 
Regards
     Stephen


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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