If i’m walking through a pipe,how to create the shaky effect(in terms of view). In 3Dgames if we walk through a tunnel, the walking effect is depicted as a shaky effect(in terms if view). I want to create something like that.
I’m using glLookAt for viewing. I introduced a variable for y axis(which is my updirection) and i keep adding and subtracting(0.2) alternatively.
zz - variable for walking
yy - variable for shaky effect
gluLookAt(7, -12+yy, 5+zz, 3, -12, 5, 0, 1, 0);
changed yy value to -1 and +1
But I can’t see the effect. Anything wrong in my logic or this logic won’t work to create that effect?
You’re redrawing the scene after you change gluLookAt, right?
A bit more code might be helpful
Try shaking the reference point in addition to shaking the eye point (not necessarily by the same amount or phase). Also you might want to implement a smoother shaking algorithm, one that continuously (or rather piecewise continuously) oscillates rather than makes discrete steps.
[This message has been edited by DFrey (edited 04-15-2002).]
I got it. but now i have new trouble. I’m not able to retain a value in a variable in windows_idle function
printf(“I’m in p= %d”,&p);
p is a global pointer and ‘pp’ holds the value 0 or 1. I assigned the pointer to pp in initialising function. but no effect. it always fails in the if condition and executes the else part. so the viewpoint moves away from the model.
help me guys
You have an assignment expression in that if clause rather than a relational expression. Looks like you typed = when you meant ==.
Thanks for pointing out the mistake Mr.Frey. I got it. It works.