I was toying with this idea, and I'm not sure it works for anything, but it would definitely help with things like the compass or watch (or anything with a dynamic texture).
(in camera.cpp around line 400 or so)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
f32 bobfrac = my_modf(m_view_bobbing_anim);
wield_position.X -= sin(bobfrac*M_PI*2.0) * 3.0;
wield_position.Y += sin(my_modf(bobfrac*2.0)*M_PI) * 3.0;
// make the wield look a bit more realistic
f32 fadjust = player->getPitch() / 90.0;
if (fadjust >= 0.0)
{
// look down = look into your wield
wield_position.X -= 55 * fadjust;
wield_position.Y += 35 * fadjust;
wield_position.Z -= 25 * fadjust;
wield_rotation.X -= 80 * fadjust;
wield_rotation.Y += 60 * fadjust;
wield_rotation.Z -= 80 * fadjust;
}
}
m_wieldnode->setPosition(wield_position);
m_wieldnode->setRotation(wield_rotation);
The above is a crude approximation of what I'm thinking.