open
CCameraFPSSceneNode.cpp
find line
Code: Select all
const f32 MAX_VERTICAL_ANGLE = 88.0f;
Code: Select all
int frame = 1;
int walk = 1;
f32 LastBobbingTime = os::Timer::getTime();
Code: Select all
if (CursorKeys[0])
pos += movedir * (f32)timeDiff * MoveSpeed;
Code: Select all
if (CursorKeys[0]){
pos += movedir * (f32)timeDiff * MoveSpeed;
if(os::Timer::getTime()-LastBobbingTime >=10) //every 10 ms
{
if (walk == 1) {
RelativeRotation.X += 0.14f; //change rotation
RelativeRotation.Y += 0.05f;
++frame;
if(frame >= 20) {
walk = 2;
}
}
if(walk == 2){
RelativeRotation.X -=0.14f;
RelativeRotation.Y += 0.05f;
++frame;
if(frame >= 40) {
walk = 3;
}
}
if(walk == 3){
RelativeRotation.X +=0.14f;
RelativeRotation.Y -= 0.05f;
++frame;
if(frame >= 60) {
walk = 4;
}
}
if(walk == 4){
RelativeRotation.X -=0.14f;
RelativeRotation.Y -= 0.05f;
++frame;
if(frame >= 80) { //animation frame loop
walk = 1;
frame = 1;
}
}
LastBobbingTime = os::Timer::getTime();
}
}
for more choppiness animation change frame numbers (20,40,6...) to smaller.
and if you would like strafing or backward move with bobbing, add this lines there too