I am trying to make an object(node) orbit aother object (node).
I do not understand the syntax for createFlyCircleAnimator - specifically, the "center".
So, having TWO Nodes (Parent and Child), I want to have the CHILD orbit the Parent. How do I determine "center" of the Parent Node to supply it to createFlyCircleAnimator "center"?
I tried ParentNode->getPostion but that doesn't work.
createFlyCircleAnimator
Here is my code:
.....
scene::ISceneNodeAnimator* SChildAnim = 0;
ChildAnim = smgr->createFlyCircleAnimator (
vector3df(
ParentNode->getPosition().X,
ParentNode->getPosition().Y,
ParentNode->getPosition().Z
),
100.0f
);
ChildNode->addAnimator(ChildAnim);
ChildAnim->drop();
......
This code works - sort of.
The child will orbit the parent correclty, however, I can NOT control the ORBIT RADIUS. According to the documentation, the orbit radius variable should be in the "ParentNode->getPosition().Y" position. If I attempt to put anything else in there, the center of orbit is relocated but the radius of the orbit is the same. Know matter where I put the ChildAnim, it always rotates at the same orbit radius.
What am I doing wrong?
What is my goal? To have a sun with orbiting planets. The planets will have orbiting moons, etc. So, the location for the center of orbit changes depending on the location of the parent node.
.....
scene::ISceneNodeAnimator* SChildAnim = 0;
ChildAnim = smgr->createFlyCircleAnimator (
vector3df(
ParentNode->getPosition().X,
ParentNode->getPosition().Y,
ParentNode->getPosition().Z
),
100.0f
);
ChildNode->addAnimator(ChildAnim);
ChildAnim->drop();
......
This code works - sort of.
The child will orbit the parent correclty, however, I can NOT control the ORBIT RADIUS. According to the documentation, the orbit radius variable should be in the "ParentNode->getPosition().Y" position. If I attempt to put anything else in there, the center of orbit is relocated but the radius of the orbit is the same. Know matter where I put the ChildAnim, it always rotates at the same orbit radius.
What am I doing wrong?
What is my goal? To have a sun with orbiting planets. The planets will have orbiting moons, etc. So, the location for the center of orbit changes depending on the location of the parent node.
-
- Posts: 63
- Joined: Thu Aug 05, 2004 9:40 am
- Location: Germany
Hi Van,
I know exactly what you want to do, I faced the same problems.
On creation variables and constants are passed to any animator. The variables are influenced by the node it is attached to. Unfortunately in the case of the FlyCircleAnimator the radius is fixed and cannot be changed on runtime.
In the moment I'm working out a little demo for a new FlyCircleAnimator. It's not finished yet. It will feature a callback functionality. It is already possible to pass an additional variable to determine the plane of ecliptic on creation.
You may have a look at the german Irrlicht-Portal:
http://exelsior.ex.funpic.de/readarticl ... ticle_id=9
There I provided also a download link for an mscv6 project. As it is a german site i included an englisch readme in the source.
I know exactly what you want to do, I faced the same problems.
On creation variables and constants are passed to any animator. The variables are influenced by the node it is attached to. Unfortunately in the case of the FlyCircleAnimator the radius is fixed and cannot be changed on runtime.
In the moment I'm working out a little demo for a new FlyCircleAnimator. It's not finished yet. It will feature a callback functionality. It is already possible to pass an additional variable to determine the plane of ecliptic on creation.
You may have a look at the german Irrlicht-Portal:
http://exelsior.ex.funpic.de/readarticl ... ticle_id=9
There I provided also a download link for an mscv6 project. As it is a german site i included an englisch readme in the source.
-
- Posts: 63
- Joined: Thu Aug 05, 2004 9:40 am
- Location: Germany