See your own player

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
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:
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
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
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
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

by Traxie21 » Tue Apr 02, 2013 15:48

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

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: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Tue Apr 02, 2013 16:31

This is amazing!
If you can think it, you can make it.
 

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

by PilzAdam » Tue Apr 02, 2013 16:37

Windows build added.
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Tue Apr 02, 2013 18:45

Pilzadam, how does one apply a patch?

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
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

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
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
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:
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
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 :)
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
git apply p.patch
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
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
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

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
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
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

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

by windmere33 » Wed Apr 17, 2013 21:40

The download link is broken.
Active Contributor To Thaumtest!
 

User avatar
Inocudom
Member
 
Posts: 2889
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.
 

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: 2889
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.
 

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

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

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
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
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: 2889
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?)
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
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.
 

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

by Inocudom » Mon May 06, 2013 15:26

PilzAdam wrote:
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.


Then this should be successful one day? I would hope so, for it would add a good deal to the immersion factor.
 

User avatar
SONICBLAST5678
New member
 
Posts: 5
Joined: Sun Jul 01, 2012 20:52

by SONICBLAST5678 » Thu May 30, 2013 15:20

pilzadam, can you fix the download link to the windows build?
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Thu May 30, 2013 16:20

SONICBLAST5678 wrote:pilzadam, can you fix the download link to the windows build?

omploader deletes files after some time, I'm sure PilzAdam hasn't got the .zip file anymore
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

by PilzAdam » Thu May 30, 2013 17:05

SONICBLAST5678 wrote:pilzadam, can you fix the download link to the windows build?

Re-uploaded to my dropbox win build folder (in "other"): https://www.dropbox.com/sh/am3ddzfm8qxz9w0/VlbFIebGBK
sfan5 wrote:omploader deletes files after some time, I'm sure PilzAdam hasn't got the .zip file anymore

:-p
 

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

by Inocudom » Fri May 31, 2013 03:08

You should keep working on this, PilzAdam. I like the idea of being able to see myself in-game.
 

Next

Return to Minetest Engine

Who is online

Users browsing this forum: No registered users and 15 guests