Look down = look at your wield

For people working on the C++ code.
Post Reply
gsmanners
Member
Posts: 159
Joined: Fri Jan 10, 2014 21:37

Look down = look at your wield

by gsmanners » Post

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.

User avatar
LuxAtheris
Member
Posts: 169
Joined: Fri Oct 25, 2013 00:54
Location: Aether

by LuxAtheris » Post

That looks very EPIC.
Good work gsmanners.
Believe you can and you’re halfway there.

MrElmux
Member
Posts: 17
Joined: Sun Dec 29, 2013 09:50
Location: North Western Germany

by MrElmux » Post

Maybe add some function like on_down to the minetest api .

gsmanners
Member
Posts: 159
Joined: Fri Jan 10, 2014 21:37

by gsmanners » Post

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest