ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Making a bot move in a circle. (Sdk)
Making a bot move in a circle. // Sdkpc maniakMay 20, 2002, 4:41am
Hi,
Does anyone know how I can make a bot go round in a circle? I tired to do it, but the bot zoomed off beyond recovery. pls help :) brantMay 20, 2002, 10:27am
To do this, you'd need to think of the movement as a math equation. The
parametric (or one variable) system of equations for a two-dimensional circle are: x = R*cos(t) y = R*sin(t), where t is in radians between 0 and 2 times pi, and R is the radius of the circle. Since AW uses the Z-axis instead of Y for depth, replace Z for Y in these equations. The speed at which the bot moves around the circle can be changed according to how fast the parameter (t) changes - so to make the bot move faster, use a for loop (in C++) or a timer (in VB) to increment the value t from zero to 2 times pi faster or slower depending on the speed you want. Replace R with the radius of the circle, and you should be all set. I would explain it more specifically, but I don't know which language you're using. Hope this helps, -Brant [View Quote] kahMay 20, 2002, 12:09pm
"brant" <awteen at shoemakervillage.org> wrote in
news:3ce8eb97$1 at server1.Activeworlds.com: > To do this, you'd need to think of the movement as a math equation. > The parametric (or one variable) system of equations for a > two-dimensional circle are: > > x = R*cos(t) > y = R*sin(t), > where t is in radians between 0 and 2 times pi, and R is the radius of > the circle. > > Since AW uses the Z-axis instead of Y for depth, replace Z for Y in > these equations. The speed at which the bot moves around the circle > can be changed according to how fast the parameter (t) changes - so to > make the bot move faster, use a for loop (in C++) or a timer (in VB) > to increment the value t from zero to 2 times pi faster or slower > depending on the speed you want. Replace R with the radius of the > circle, and you should be all set. > > I would explain it more specifically, but I don't know which language > you're using. > > Hope this helps, > > -Brant Z is meant to be depth, so it's quite normal (X: width, Y: height and Z: depth). But it would be Y in your equation if you do a 2D circle on a picture, since pictures don't have any depth. KAH |