CreateFlyCircleAnimator around another axis

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
AndreOdendaal
Posts: 16
Joined: Tue Dec 27, 2005 10:13 am
Location: Johannesburg, South Africa

CreateFlyCircleAnimator around another axis

Post by AndreOdendaal »

Hi guys,

Please help me, I'm using CreateFlyCircleAnimator but I'd like to the object to "fly" around a different axis. It always rotates around the Y-axis and I've tried changing the rotation of the scenenode but that changes the object itself on the path.
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

Post by MikeR »

Code: Select all

scene::ISceneNodeAnimator* anim = 0;
	anim = smgr->createFlyCircleAnimator (core::vector3df(0,150,0),250.0f);
	node->addAnimator(anim);
	anim->drop();
(X,Y,Z),DistanceFromObjectToFly)

So to make the object fly around the X axis, just do something like (150,0,0),250.0f);
I haven't tested this tho.
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

o.O Didnt work for me when I tried it.

I wrote my own flycircleanimator...want me to post it?
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

Post by MikeR »

MikeR wrote:

Code: Select all

scene::ISceneNodeAnimator* anim = 0;
	anim = smgr->createFlyCircleAnimator (core::vector3df(0,150,0),250.0f);
	node->addAnimator(anim);
	anim->drop();
(X,Y,Z),DistanceFromObjectToFly)

So to make the object fly around the X axis, just do something like (150,0,0),250.0f);
I haven't tested this tho.
After doing some testing with this, It seems I was wrong.
The X,Y,Z is the center of your fly around point.
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Precisely.

Here is what I used for the fly circle in a vertical direction...hope you like polar coordinates :)

Code: Select all

float cRadius = 2048;
	vector3df vtPosition = pSunBillboard->getAbsolutePosition();

	//float = cout<<irrTimer->getTime()/1000<<endl;

	vtPosition.Y = cRadius * sin((irrTimer->getTime()/(AVG_SKY_TRANSITION_TIME-(SKY_TRANSITION_OFFSET))));					//2250
	vtPosition.X = cRadius * cos((irrTimer->getTime()/(AVG_SKY_TRANSITION_TIME-(SKY_TRANSITION_OFFSET))));					//(time / (AVG - 100)) - 0.3
Here are some definitions:
AVG_SKY_TRANSITION_TIME is the time you want it to take to complete the rotation

SKY_TRANSITION_OFFSET is just a offset from the 0 position in-case you need it

cRadius is the radius of the circle the sun flies in

You need you declare an ITimer, check the API documentation

If you need some more help please do ask
AndreOdendaal
Posts: 16
Joined: Tue Dec 27, 2005 10:13 am
Location: Johannesburg, South Africa

Post by AndreOdendaal »

Thanks for the help.

So there's no "native" animator which'll fly the object around any axis except the Y?
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Yep, unfortunately.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

That is why the transformation scene node exists. Here is a change to the SpecialFX sample that does exactly what you want.

Code: Select all

	// transform used to put light on another axis
	irr::scene::IDummyTransformationSceneNode* dummy = smgr->addDummyTransformationSceneNode();
	dummy->getRelativeTransformationMatrix().setRotationDegrees(core::vector3df(30.f, 0.f, 0.f));

	node = smgr->addLightSceneNode(dummy, core::vector3df(0,0,0), 
		video::SColorf(1.0f, 0.6f, 0.7f, 1.0f), 600.0f);
	scene::ISceneNodeAnimator* anim = 0;
	anim = smgr->createFlyCircleAnimator (core::vector3df(0,150,0),250.0f);
	node->addAnimator(anim);
	anim->drop();
sdi2000
Posts: 129
Joined: Thu Aug 25, 2005 12:19 pm
Location: Berlin, DE
Contact:

Post by sdi2000 »

take a look at this thread
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=10944
find the headline better solution, implement this code sniped and you can rotate around all axis :D
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

I believe that your code in the other thread does exactly the same thing, except that it does more work. The dummy scene node can be rotated any amount on any axis also.

The advantage of my solution is that it doesn't require any changes to the library, and the matrix can be accessed easily at runtime. This is especially good for people who don't want to have to rebuild the library but want better control over the scene node.

Travis
Post Reply