Page 1 of 1

Look down = look at your wield

Posted: Mon Jan 20, 2014 18:27
by gsmanners
Image

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)

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.

Posted: Sat Jan 25, 2014 07:35
by LuxAtheris
That looks very EPIC.
Good work gsmanners.

Posted: Sat Feb 22, 2014 08:59
by MrElmux
Maybe add some function like on_down to the minetest api .

Posted: Mon Feb 24, 2014 20:08
by gsmanners
Actually, I was thinking that the way to implement it would be to have a flag for it in the node definition. Something like MAPLIKE or whatever.