See your own player

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

See your own player

by PilzAdam » Tue Apr 02, 2013 15:21

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: 3157
Joined: Mon Aug 01, 2011 14:26
Location: Troyes, France
GitHub: Calinou
IRC: Calinou
In-game: Calinou

by Calinou » Tue Apr 02, 2013 15:41

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.
 

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

by PilzAdam » Tue Apr 02, 2013 16:27

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
Location: Rhode Island, USA
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Tue Apr 02, 2013 16:31

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

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

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

by Jordach » Tue Apr 02, 2013 18:45

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
Location: United Kingdom
GitHub: stujones11

by stu » Tue Apr 02, 2013 22:13

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 » Tue Apr 02, 2013 22:26

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

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

by Calinou » Wed Apr 03, 2013 09:02

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
 

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

by keneticquartz » Wed Apr 03, 2013 12:43

Or just use :)
Code: Select all
git apply p.patch
 

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

by sfan5 » Wed Apr 03, 2013 13:51

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
Location: Germany
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Wed Apr 03, 2013 14:15

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 » Wed Apr 03, 2013 17:38

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: 3817
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Fri Apr 05, 2013 12:03

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 » Fri Apr 05, 2013 17:54

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 » Wed Apr 17, 2013 21:40

The download link is broken.
Active Contributor To Thaumtest!
 

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

by Inocudom » Mon Apr 22, 2013 16:16

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 » Mon Apr 22, 2013 17:13

This and Kaeza's experiments with moving head ;)
 

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

by Inocudom » Thu Apr 25, 2013 03:28

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 » Thu Apr 25, 2013 11:11

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

by Ragnar » Thu May 02, 2013 12:19

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: 3157
Joined: Mon Aug 01, 2011 14:26
Location: Troyes, France
GitHub: Calinou
IRC: Calinou
In-game: Calinou

by Calinou » Thu May 02, 2013 12:32

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: 3072
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Mon May 06, 2013 00:12

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
Location: Germany
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Mon May 06, 2013 00:32

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.
 

Next

Return to Partly official engine development



Who is online

Users browsing this forum: No registered users and 0 guests