PDA

View Full Version : sphere moving animation..its very urgent..thanks



NarutoUzumakis
01-14-2011, 05:58 PM
does anyone have an idea how would i do an animation for the next problem?i have 2 rectangles and one sphere(as its shown in this picture(open the next link and just look at the pic))

the link:

http://poincare.matf.bg.ac.rs/~ivan/files/rg/ispiti/200910-09-zadatak.pdf
.....
when we press some key,lets say 'g' the animation should start;the animation is:the sphere should move through the corridor on the path which is shown as a dotted line(it should move between those 2 rectangles).....
i have no idea how to do that,its obvious there are four different translations,i can translate it on the x-axes first but then what should i do??

can you please help..its very important,ill have an exam at my college soon and we'll have this type of assignment!!
thanks
niko

ZbuffeR
01-15-2011, 08:09 AM
You dare posting this in the advanced forum... come on, are you joking ?

Store the 4 corner positions in an array, then linearly interpolate position offset according to frame number (crappy) or time elapsed (way better) and use this offset in glTranslate

NarutoUzumakis
01-16-2011, 06:18 AM
yeah,i know thats the idea,its quite simple,but i tried doing it that way and it just didnt work for some reason,anyway thanks for the reply,ill try to find where i made a mistake

ugluk
01-16-2011, 08:17 AM
Don't cheat at exams, or you'll have problems because of that later on.

NarutoUzumakis
01-16-2011, 05:50 PM
haha,im not cheating,i know basics of openGL quite well,i did two big course-works in openGL regarding probability and geometry.I'm just a bit on a down side when it comes to animation,i havent done almost any of it,thats why i asked for an explanation of how this would be done,but never mind,thanks anyway,for your advices!

MaxH
01-16-2011, 07:07 PM
Google glutsetidle to find out how to do animation. Look at some examples. What U R trying to do is actually very straightforward.

NarutoUzumakis
01-18-2011, 07:55 AM
yeah,it is easy,i got it right,did some basic animation too,thanks