CreateFlyCircleAnimator around another axis
-
- Posts: 16
- Joined: Tue Dec 27, 2005 10:13 am
- Location: Johannesburg, South Africa
CreateFlyCircleAnimator around another axis
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.
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.
Code: Select all
scene::ISceneNodeAnimator* anim = 0;
anim = smgr->createFlyCircleAnimator (core::vector3df(0,150,0),250.0f);
node->addAnimator(anim);
anim->drop();
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
Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
After doing some testing with this, It seems I was wrong.MikeR wrote:(X,Y,Z),DistanceFromObjectToFly)Code: Select all
scene::ISceneNodeAnimator* anim = 0; anim = smgr->createFlyCircleAnimator (core::vector3df(0,150,0),250.0f); node->addAnimator(anim); anim->drop();
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.
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
Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
Precisely.
Here is what I used for the fly circle in a vertical direction...hope you like polar coordinates
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
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
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
-
- Posts: 16
- Joined: Tue Dec 27, 2005 10:13 am
- Location: Johannesburg, South Africa
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();
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
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=10944
find the headline better solution, implement this code sniped and you can rotate around all axis
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
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