Hi,

I made a rectangle and want to animate it from (0, 0, 0) to (n, 0, 0) 2pixel 
per a sec.

I found an update code and I call the method in here.
while(!viewer.done())
{
    viewer.frame();
   update(second);
}

but i don't know how to calculate it to meet the issue. 

here's a part of update code.
void update(float dt)
{
   myTimer += dt;
   Vec3d currentPosition = transform[0]->getPosition();
   Vec3d *newPosition;
   newPosition = new Vec3d(currentPosition.x() + dt * ????, 
currentPosition.y(), currentPosition.z());

   object->setPosition(Vec3(newPosition->x(), newPosition->y(), 
newPosition->z()));
}

I guess this line (newPosition = new Vec3d(currentPosition.x() + dt * ????, 
currentPosition.y(), currentPosition.z());) is to animate the shape.

currentPosition.x() + dt * ??? <-- how ?

Sorry about posting very basic thing which is very hard to me. :(

anyone have any good link for me to understand the logic or can explan the 
process?

Thank you!

Cheers,
Eungil,

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50623#50623





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to