Page 1 of 1

is it possible to rotate a flycircleAnimator?

Posted: Thu Jul 21, 2005 7:14 pm
by rsdl
Is it possible to change the orientation of the flycircle animator?, that is, instead of circling around the Y-axis, would it be possible to rotate it and make it fly around the X-axis instead? I tried using setRotation() but it doesn't seem to be doing anything...

Any ideas?

Posted: Fri Jul 22, 2005 2:00 am
by etcaptor
If I understood well, you can use fly circle animator by each from axis X,Y,Z. If you want and rotation simultaneously, you can attach rotation animator in addition.

Posted: Fri Jul 22, 2005 8:16 am
by rsdl
thanks for the reply etcaptor.
see the image. The motion path of the flycircle animation by default is the green circle. I was wondering how you could turn the motion path into the blue circle.

Image

I looked at the API and there was no option to turn the motion path to the blue circle. I also tried rotating the SceneNode that was being animated but it didn't work.

This is the code so far:

Code: Select all

   // add light
   light = smgr->addLightSceneNode(0, core::vector3df(0,100.0f,1200.0f), 
         video::SColorf(0.5f, 1.0f, 0.5f, 0.0f), 200.0f);
       lightData = &light->getLightData();
       lightData->Radius = 100.0f;
       lightData->AmbientColor = SColorf(255.0f,255.0f,255.0f,50.0f);
   light->setPosition(core::vector3df(1529*2,4031*2,5658*2));
   light->setMaterialFlag(video::EMF_LIGHTING, true);
   light->setMaterialType(video::EMT_LIGHTMAP_LIGHTING);

	// add fly circle animator to light 1
	scene::ISceneNodeAnimator* lightAnimator = smgr->createFlyCircleAnimator(core::vector3df(50,10000,10000),1900.0f, 0.001f);
	light->addAnimator(lightAnimator);
	lightAnimator->drop();

any ideas?

Posted: Fri Jul 22, 2005 9:31 am
by mm765
flyrotatedcicrleanimator in irrlichtnx++

Posted: Fri Jul 22, 2005 6:26 pm
by etcaptor
Sory, now I understood.
Here is a code of this animator.

Code: Select all

//! animates a scene node
void CSceneNodeAnimatorFlyCircle::animateNode(ISceneNode* node, u32 timeMs)
{
    Node = node;//ivo

	core::matrix4 mat;

	f32 t = (timeMs-StartTime) * Speed;

	core::vector3df circle(Radius * (f32)sin(t), 0, Radius * (f32)cos(t));
	node->setPosition(Center + circle);
}
You can improve it. By example if you use:

Code: Select all

core::vector3df circle(Radius * (f32)sin(t), 0, Radius * (f32)cos(t));
will get animate function via YZ.

You can add some variables or methods for choising behaviour of animator - via Y, YZ or XZ axis.

Posted: Fri Jul 22, 2005 7:28 pm
by Guest
thanks guys! it works now. I added a switch in the irrlicht source so that i could change the axis on the fly :D