PDA

View Full Version : animation in qt



rimie23
4th May 2012, 21:16
Hi
i want to make animation of my object (i use ogre)
is there any idea how i do that ?

amleto
5th May 2012, 11:52
http://lmgtfy.com/?q=qt+animation

d_stranz
5th May 2012, 23:01
http://lmgtfy.com/?q=qt+animation

Very clever. Have to remember that for the next time someone asks me a question they could have answered for themselves with a little bit of effort.

rimie23
6th May 2012, 08:53
Hi
thanks for repling
beh,
yes , i see the links (before you put it her "i made effeort":p) but there is not like what i want
in my case i have in each frame the position of my objects like that


frame[i].object.x//frame[0].object.x=...,frame[1].object.x=.....,...............................
frame[i].object.y
frame[i].object.z

so i want when i clic to button i see my object in the new positions in each frame (like an animation)

amleto
6th May 2012, 11:09
well, I dont know about ogre, but if you were rendering by qt, then use a basic index for time, or use http://qt-project.org/doc/qt-4.8/qtimeline.html.

then reimplement paintevent to draw your objects using the time index.


void widget::paintEvent(qpaintevent * evt)
{
int time = getTime(); // get time index from qtimeline or some other counter

// for each object in frame
drawObjectAt(object, frame[tim].object.x, frame[tim].object.y, frame[tim].object.z); // func that draws an object at specific location.
}


btw, it looks strange that you seem to have object as a property on frame. Normally animation would be a function of a model or model id.

also might be useful
http://www.developer.nokia.com/Community/Wiki/How_to_create_a_simple_animation_using_QTimeLine_i n_Qt