Look down = look at your wield

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

Look down = look at your wield

by gsmanners » Mon Jan 20, 2014 18:27

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)
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.
 

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

by LuxAtheris » Sat Jan 25, 2014 07:35

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

by MrElmux » Sat Feb 22, 2014 08:59

Maybe add some function like on_down to the minetest api .
 

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

by gsmanners » Mon Feb 24, 2014 20:08

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.
 


Return to Minetest Engine

Who is online

Users browsing this forum: No registered users and 19 guests

cron