See your own player

For people working on the C++ code.
User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

See your own player

by PilzAdam » Post

Hello everyone!
I have played a bit arround with the player model and here is the result:
Image
You can see your own model when looking down. It has all the animations that other players have.
Here is the engine patch:

Code: Select all

diff --git a/src/content_cao.cpp b/src/content_cao.cpp
index ee1009b..be66e9f 100644
--- a/src/content_cao.cpp
+++ b/src/content_cao.cpp
@@ -850,7 +850,7 @@ class GenericCAO : public ClientActiveObject
         
         m_visuals_expired = false;
 
-        if(!m_prop.is_visible || m_is_local_player)
+        if(!m_prop.is_visible)
             return;
     
         //video::IVideoDriver* driver = smgr->getVideoDriver();
@@ -1068,6 +1068,40 @@ class GenericCAO : public ClientActiveObject
 
     void step(float dtime, ClientEnvironment *env)
     {
+        //HACK!!
+        if(m_is_local_player)
+        {
+            LocalPlayer *player = m_env->getLocalPlayer();
+            m_position = player->getPosition() + v3f(0,10,0);
+            m_velocity = v3f(0,0,0);
+            m_acceleration = v3f(0,0,0);
+            pos_translator.vect_show = m_position;
+            m_yaw = player->getYaw();
+            v3f offset(sin(m_yaw/180.*core::PI)*BS*0.5, 0, -cos(m_yaw/180.*core::PI)*BS*0.5);
+            m_position += offset;
+
+            PlayerControl controls = player->getPlayerControl();
+            bool walking = false;
+            if(controls.up || controls.down or controls.left || controls.right)
+                walking = true;
+
+            m_animation_speed = 30;
+
+            if(controls.sneak && walking)
+                m_animation_speed = 15;
+
+            //if(player->hp == 0)
+            //    m_animation_range = v2f(162, 166);
+            if(walking && (controls.LMB || controls.RMB))
+                m_animation_range = v2f(200, 219);
+            else if(walking)
+                m_animation_range = v2f(168, 187);
+            else if(controls.LMB || controls.RMB)
+                m_animation_range = v2f(189, 198);
+            else
+                m_animation_range = v2f(0, 79);
+        }
+
         if(m_visuals_expired && m_smgr && m_irr){
             m_visuals_expired = false;
 
@@ -1680,9 +1714,11 @@ class GenericCAO : public ClientActiveObject
         }
         else if(cmd == GENERIC_CMD_SET_ANIMATION)
         {
-            m_animation_range = readV2F1000(is);
-            m_animation_speed = readF1000(is);
-            m_animation_blend = readF1000(is);
+            if(!m_is_local_player){
+                m_animation_range = readV2F1000(is);
+                m_animation_speed = readF1000(is);
+                m_animation_blend = readF1000(is);
+            }
 
             updateAnimation();
         }
win build: https://www.dropbox.com/sh/am3ddzfm8qxz9w0/VlbFIebGBK (in other/minetest-0.4.5-0770b3e-player_model-win32.zip)
Last edited by PilzAdam on Thu May 30, 2013 17:06, edited 1 time in total.

User avatar
Calinou
Moderator
Posts: 3164
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

by Calinou » Post

Since we can do this, we could also do third person. :)

Nice!

User avatar
Traxie21
Member
Posts: 753
Joined: Mon Dec 31, 2012 10:48
Location: McKinney, Texas U.S.A.
Contact:

by Traxie21 » Post

Neet!
Will this be committed into the main game?

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

by PilzAdam » Post

Traxie21 wrote:Neet!
Will this be committed into the main game?
No, its hacky. It has to be done differently. I just played a bit arround with the code.

User avatar
jordan4ibanez
Member
Posts: 1895
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez
Location: Rhode Island, USA

by jordan4ibanez » Post

This is amazing!
I've been gone for a long time

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

by PilzAdam » Post

Windows build added.

Jordach
Member
Posts: 4523
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach
Location: Blender Scene

by Jordach » Post

Pilzadam, how does one apply a patch?
viewtopic.php?f=10&t=19056 Solar Plains Dev Server

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

by stu » Post

Wow, this even works rather well with my 3d_armor and wieldview mods.
Image

User avatar
jojoa1997
Member
Posts: 2890
Joined: Thu Dec 13, 2012 05:11
Location: Earth

by jojoa1997 » Post

i like it
Coding;
1X coding
3X debugging
12X tweaking to be just right

User avatar
Calinou
Moderator
Posts: 3164
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

by Calinou » Post

Jordach wrote:Pilzadam, how does one apply a patch?
Save the content of the patch in a file named "content_cao.patch", put it in your Minetest's "src" directory, then open a terminal in that directory and type:

Code: Select all

patch content_cao.cpp content_cao.patch

User avatar
keneticquartz
Member
Posts: 15
Joined: Tue Jan 15, 2013 02:56

by keneticquartz » Post

Or just use :)

Code: Select all

git apply p.patch

User avatar
sfan5
Moderator
Posts: 3929
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

Awesome!

EDIT: For some reason (seems to be a problem with spaces) my git doesn't want to apply the patch.
Last edited by sfan5 on Wed Apr 03, 2013 13:54, edited 1 time in total.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

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

by PilzAdam » Post

I also have a branch for this on my forked repo," player_model" or something like that.

User avatar
Likwid H-Craft
Member
Posts: 1113
Joined: Sun Jan 06, 2013 14:20
Location: Lost in Crypt

by Likwid H-Craft » Post

Wow, you should make this work for, 0.4.6 and have it bind to F7 :)
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)

User avatar
sfan5
Moderator
Posts: 3929
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

Why bind it to a key?
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
Likwid H-Craft
Member
Posts: 1113
Joined: Sun Jan 06, 2013 14:20
Location: Lost in Crypt

by Likwid H-Craft » Post

Idk it just how systems now days, is bind bind BIND!
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)

User avatar
windmere33
Member
Posts: 100
Joined: Thu Apr 04, 2013 19:21
Location: North Carolina, USA

by windmere33 » Post

The download link is broken.
Active Contributor To Thaumtest!

User avatar
Inocudom
Member
Posts: 3096
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Post

I like this very much. I wish for this to be added to the base game.
You can now find my videos at BitChute: https://www.bitchute.com/channel/some_cheeky_jinuskian/

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Post

This and Kaeza's experiments with moving head ;)

User avatar
Inocudom
Member
Posts: 3096
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Post

This look like a possible and reachable goal. I hope this turns out to be a successful effort. Just make sure that the player model doesn't obscure the tile that the player is standing on too much.
You can now find my videos at BitChute: https://www.bitchute.com/channel/some_cheeky_jinuskian/

User avatar
jojoa1997
Member
Posts: 2890
Joined: Thu Dec 13, 2012 05:11
Location: Earth

by jojoa1997 » Post

with this you could move the camera back and see your own player. maybe pressing a special button can go ointo switch mode and another will go into pan mode
Coding;
1X coding
3X debugging
12X tweaking to be just right

Ragnar
Member
Posts: 850
Joined: Thu Oct 25, 2012 15:19
Location: Estonia
Contact:

by Ragnar » Post

does that mean that others can see the current hand-held stuff?
Are you saying that I put an abnormal brain into a seven and a half foot long, fifty-four inch wide GORILLA?

User avatar
Calinou
Moderator
Posts: 3164
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

by Calinou » Post

Ragnar wrote:does that mean that others can see the current hand-held stuff?
No, showing what you have in hand to other players is done with another (server-side) mod:
http://forum.minetest.net/viewtopic.php?id=4654

User avatar
Inocudom
Member
Posts: 3096
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Post

This feature looked like it had a future, but then development stopped. Is there a coder in this community that can continue the development of this feature (maybe make it as a mod first?)
You can now find my videos at BitChute: https://www.bitchute.com/channel/some_cheeky_jinuskian/

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

by PilzAdam » Post

Inocudom wrote:This feature looked like it had a future, but then development stopped. Is there a coder in this community that can continue the development of this feature (maybe make it as a mod first?)
I had the plan to add API functions to set the playermodel with all the animations etc. This can be send to the client and it can be used there.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests