createFlyCircleAnimator speed value

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
jaxl
Posts: 6
Joined: Wed Jan 14, 2009 2:38 pm

createFlyCircleAnimator speed value

Post by jaxl »

What exactly is the units for this "speed" value? I tried setting it to 1 guessing it would be one orbit/sec and was wrong.

createFlyCircleAnimator (
center vector3df(x,y,z),
f32 radius=100.f,
f32 speed=0.001f,
direction vector3df(x,y,z)
);
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Could be units per second...
Image Image Image
jaxl
Posts: 6
Joined: Wed Jan 14, 2009 2:38 pm

Post by jaxl »

JP wrote:Could be units per second...
Hmm. I took Calc III 3 times, you'd think I'd remember this should work...

Code: Select all


void CSceneNodeAnimatorFlyCircle::init()
{
        Direction.normalize();

        if (Direction.Y != 0)
                VecV = core::vector3df(50,0,0).crossProduct(Direction).normalize();
        else
                VecV = core::vector3df(0,50,0).crossProduct(Direction).normalize();
        VecU = VecV.crossProduct(Direction).normalize();
}


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

        const f32 t = (timeMs-StartTime) * Speed;

        node->setPosition(Center + Radius * ((VecU*cosf(t)) + (VecV*sinf(t))));
}

jaxl
Posts: 6
Joined: Wed Jan 14, 2009 2:38 pm

Post by jaxl »

jaxl wrote:
JP wrote:Could be units per second...
Hmm. I took Calc III 3 times, you'd think I'd remember this should work...

Perhaps per ms? I dug out some code..

Code: Select all


void CSceneNodeAnimatorFlyCircle::init()
{
        Direction.normalize();

        if (Direction.Y != 0)
                VecV = core::vector3df(50,0,0).crossProduct(Direction).normalize();
        else
                VecV = core::vector3df(0,50,0).crossProduct(Direction).normalize();
        VecU = VecV.crossProduct(Direction).normalize();
}


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

        const f32 t = (timeMs-StartTime) * Speed;

        node->setPosition(Center + Radius * ((VecU*cosf(t)) + (VecV*sinf(t))));
}

Last edited by jaxl on Fri Jan 16, 2009 4:27 pm, edited 1 time in total.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Heh, it appears to be radians per millisecond. I mean, obviously!

We can either comment it as that, or change it to (e.g.) degrees per second in 1.6. Opinions?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Probably best to just document it as rps rather than break compatibility by making such a small change?
Image Image Image
jaxl
Posts: 6
Joined: Wed Jan 14, 2009 2:38 pm

Post by jaxl »

rogerborg wrote:Heh, it appears to be radians per millisecond. I mean, obviously!

We can either comment it as that, or change it to (e.g.) degrees per second in 1.6. Opinions?
Ah-Ha, Venus is now going the correct speed around my Sun, thank you..
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Fair enough. Documented on 1.5 in SVN 2084, and it'll filter down to the trunk later.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply