is it possible to rotate a flycircleAnimator?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
rsdl
Posts: 13
Joined: Wed May 05, 2004 6:57 am
Location: Soviet Canuckistan

is it possible to rotate a flycircleAnimator?

Post 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?
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post 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.
ImageImage
Site development -Rock and metal online
--- etcaptor.com ------freenetlife.com
rsdl
Posts: 13
Joined: Wed May 05, 2004 6:57 am
Location: Soviet Canuckistan

Post 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?
mm765
Posts: 172
Joined: Fri May 28, 2004 10:12 am

Post by mm765 »

flyrotatedcicrleanimator in irrlichtnx++
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post 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.
ImageImage
Site development -Rock and metal online
--- etcaptor.com ------freenetlife.com
Guest

Post 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
Post Reply