|
![](/i/fill.gif) |
wizkidguy wrote:
> I am trying to rotate a group of objects in a circle. how can i do this? i
> am using a while loop and i cannot figure out to make them move in a
> circle.
>
Thats what the Povray rotate is for. But remember, all rotations, (and
scalings) are relative to the coordinate axes. This means you have to
create your set of objects centered at the origin (or translate them
there) to perform the rotation, then, if necessary, translate them to
their final location. This is easiest if you make your set of objects a
union so you can rotate and translate them as a unit.
As a short example, there was an animated image that was rather commonly
available many years ago. Here is my attempt at recreating that image.
(The original used a 2x2 checkerboard, mine is 4x4, and I don't
remember what the original background was like -- I made mine a simple
sky-sphere.) Incidentally, the original image was said to be made with
Povray -- I think that is where I first learned about it. (Probably
still at version 1 at that time.) :-)
// balls.pov -- Attempting to reproduce the rotating ball
// image from years ago
#include "colors.inc"
#include "skies.inc"
camera
{
location <3, 5, -15>
look_at <0, -2, 0>
angle 40
}
light_source { <-5, 20, -30> White }
light_source { <10, 50, -20> Gray50 }
sky_sphere { S_Cloud3 }
box
{
<-5, -2.5, -5>, <5, -2, 5>
pigment { checker Red White scale 2.5 }
}
#declare Ball = sphere
{
0, .8
pigment { Black }
finish { reflection 1 phong .8 }
}
// Create the circle of 8 balls
#declare Circle = union
{
#local Angle = 0;
#while (Angle < 360)
object
{
Ball
translate <4, 0, 0>
rotate <0, Angle, 0>
}
#local Angle = Angle + 45;
#end
}
// Animate (rotate) the circle
object
{
Circle
rotate <0, clock * 45, 0>
}
Post a reply to this message
|
![](/i/fill.gif) |