Better digging animation

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

Better digging animation

by jordan4ibanez » Fri Sep 21, 2012 21:36

In the source code, in camera.cpp at line 336 replace this:
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
if (m_digging_button != -1)
{
    f32 digfrac = m_digging_anim;
    wield_position.X -= 30 * sin(pow(digfrac, 0.8f) * M_PI);
    wield_position.Y += 15 * sin(digfrac * 2 * M_PI);
    wield_position.Z += 5 * digfrac;

    // Euler angles are PURE EVIL, so why not use quaternions?
    core::quaternion quat_begin(wield_rotation * core::DEGTORAD);
    core::quaternion quat_end(v3f(90, -10, -130) * core::DEGTORAD);
    core::quaternion quat_slerp;
    quat_slerp.slerp(quat_begin, quat_end, sin(digfrac * M_PI));
    quat_slerp.toEuler(wield_rotation);
    wield_rotation *= core::RADTODEG;
}



WITH THIS!

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
if (m_digging_button != -1)
{
    f32 digfrac = m_digging_anim;
    wield_position.X -= 50 * sin(pow(digfrac, 0.8f) * M_PI);
    wield_position.Y += 24 * sin(digfrac * 1.8 * M_PI);
    wield_position.Z += 25 * 0.5;

    // Euler angles are PURE EVIL, so why not use quaternions?
    core::quaternion quat_begin(wield_rotation * core::DEGTORAD);
    core::quaternion quat_end(v3f(80, 30, 100) * core::DEGTORAD);
    core::quaternion quat_slerp;
    quat_slerp.slerp(quat_begin, quat_end, sin(digfrac * M_PI));
    quat_slerp.toEuler(wield_rotation);
    wield_rotation *= core::RADTODEG;
}
Last edited by jordan4ibanez on Fri Sep 28, 2012 16:25, edited 1 time in total.
If you can think it, you can make it.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Sun Sep 23, 2012 12:36

what is better?
 

irksomeduck
Member
 
Posts: 224
Joined: Tue Aug 28, 2012 21:45

by irksomeduck » Sun Sep 23, 2012 17:41

I don't get it
I love exploring minetest worlds :D
If you have a good seed let me know
--------------------------------------------------
My world/house pack- http://minetest.net/forum/viewtopic.php?id=3066
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Sun Sep 23, 2012 18:13

rubenwardy wrote:what is better?

your hand doesn't twist and it actually looks like you are digging and not just flailing your hands in the air
If you can think it, you can make it.
 

wokste
Member
 
Posts: 78
Joined: Sat Feb 11, 2012 09:06

by wokste » Mon Sep 24, 2012 15:39

Please add this in an issue on github. In that case there is a bigger chance that this gets upstream.
We must be careful not to clone Notches mistakes.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Mon Sep 24, 2012 16:30

wokste wrote:Please add this in an issue on github. In that case there is a bigger chance that this gets upstream.


Pull request would be better...
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Fri Sep 28, 2012 16:42

here i've made a video demonstrating it http://youtu.be/jtZWvzkflWU and i've updated the line (336 not 366)
Last edited by jordan4ibanez on Fri Sep 28, 2012 16:42, edited 1 time in total.
If you can think it, you can make it.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Sat Sep 29, 2012 15:50

Yeah, it is good
 

User avatar
Mito551
Member
 
Posts: 1271
Joined: Sat Jun 16, 2012 15:03

by Mito551 » Sat Sep 29, 2012 19:01

good :)
it looks really nice!
Last edited by Mito551 on Sat Sep 29, 2012 19:01, edited 1 time in total.
 

Josh
Member
 
Posts: 1146
Joined: Fri Jun 29, 2012 23:11

by Josh » Mon Oct 01, 2012 04:43

Where can you find the source code?
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Mon Oct 01, 2012 07:07

Josh wrote:Where can you find the source code?

In minetest/src/
 

lord_james
Member
 
Posts: 51
Joined: Sun Mar 11, 2012 22:06

by lord_james » Wed Oct 03, 2012 23:55

Cool!!! But... Could it be possible add custom object's movement for mods? For Example, It isn't the same use a bow that eat a cookie
 

CTMN
Member
 
Posts: 113
Joined: Sat Aug 25, 2012 15:02

by CTMN » Mon Oct 08, 2012 05:53

No, but it's similar. The standart digging animation could be used for almost every action.
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 7 guests

cron