Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/20/24 06:09
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (henrybane, flink, Edgar_Herrera), 726 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Any clear working example ? #450334
04/12/15 20:04
04/12/15 20:04
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
Is there any working clear example of :

A character moving using its animation (No bones) and have physics ?
i am trying but so far no luck laugh I looked in the forum but the topics i found have dead links or no answer at all laugh

thank you

Last edited by Realspawn; 04/12/15 20:18.

Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: Any clear working example ? [Re: Realspawn] #450336
04/12/15 23:13
04/12/15 23:13
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Hello Dude.

Maybe this helps ? As always, just wrote it but didnt test yet ... guess i will, this time, need something similiar. So Feedback would be nice. I only used PhysicX one time, so if it wont work ... well lets see.

Code:
/*
   -------------------------------------------------------
   ---=[ phXhero.c ]=-------------------------------------
   -------------------------------------------------------
   lite-C A8 example of "hero / player - controller" using
    "PhysX engine" featuring vertex / frame / bone based
     animations + simple "die and blend out" - script
   note: all cam stuff is optional of course
   -------------------------------------------------------
   free contribution quick written by rayp 04.2015 germany
   -------------------------------------------------------
*/
#define animation_frame skill10             // animation percentage 0 - 100
#define health          skill11             // health points
#define speed           skill12             // ent's - speed factor * time_step = movement speed ( see mov_dist )

ENTITY* myplayer;                           // ent pointer holding "hero aka player"
VECTOR  mov_dist;                           // player is moved via this vector mov_dist.x / mov_dist.y ( use WASD )
STRING* str_walk = "walk";                  // framenames of animation ( open MED 2see them 4ex, guess u know :D )
var cam_mode     =      0;                  // 0 = player visible, 1 = invisible ( FPS-mode 4ex ).

void _mostbasicFPScam(){
   proc_mode = PROC_LATE;                   // maybe not. pls try.
   my.pan   += (mickey.x * 0.5) * time_step;// if cam-movment sucks swap X and Y of mickey for pan and tilt vectors!
   my.tilt  += (mickey.y * 0.5) * time_step;// ...as said above ... uneed2 test it
   vec_set     (camera.pan, my.pan);
   vec_set     (camera.x,   my.x);
   if ( cam_mode && !is (my, INVISIBLE)) set   (my, INVISIBLE);
   if (!cam_mode &&  is (my, INVISIBLE)) reset (my, INVISIBLE);
}

action playerWED(){	
   my.health = 100;                         // player starts with 100 health points
   my.speed  =   2;                         // movement speed
   pXent_settype (me, PH_CHAR, PH_CAPSULE); // register ent as physic object ... used it only one time, maybe change to PH_BOX?
// change bbox here if u want ( be4 the while! ) or something like:
// c_setminmax   (me);
// set           (my, POLYGON);             // or use vec_set min / max stuff see manual
// wait          (1);                       // use if u changed bbox be4
   myplayer  = me;                          // pointer to our hero ( u can use "player" instead )
 //my.frame  = Startframe of walking-anm;   // if using frame - anm
   while (my){
   // --------------------------------------------------------------------------------------------------------		
   // ---=[ physic - movement - part ]=-----------------------------------------------------------------------	
   // --------------------------------------------------------------------------------------------------------
      mov_dist.x = (my.speed * (key_w - key_s)) * time_step;     // prepare players X movement- ( WASD ) vector...
      mov_dist.y = (my.speed * (key_a - key_d)) * time_step;     // ...same4 Y of course!
    //mov_dist.z <- guess we dont need2 use ... only used physics one time, as i wrote already above
      pXent_movechar (me, mov_dist, NULL, 0);                    // finally move the player entity with our mov_dist - vector!
   // --------------------------------------------------------------------------------------------------------
   // ---=[ animation part ( vertex and bone ) ]=-------------------------------------------------------------
   // --------------------------------------------------------------------------------------------------------
      my.animation_frame += time_step * my.speed;	         // animate time corrected in (my.)speed
      my.animation_frame %= 100;                                 // 0 - 100 ( if anm "flickers" try without this line )
      ent_animate (me, str_walk, my.animation_frame, ANM_CYCLE); // finally ... cycle - animate me
   // ---=[ oldschool frame animation ... animates smooth from frame 20 to 30 ]=------------------------------
      /*
      my.frame += time_step * my.speed;
      if (my.frame >  30) my.next_frame = 20;                    // interpolate2 start frame...
      else                my.next_frame =  0;  		         // ...interpolate again
      if (my.frame >= 31) my.frame     -= 10;  	                 // 30 - 10 = 20 :D
   */
      if (my.health <= 0) break;                                 // no health? die!
      _mostbasicFPScam();                                        // xtreme simple cam-handle function ( cam_mode = 1 means player is INVISIBLE )
      wait (1);
   }
   // new school anm style again
   my.animation_frame = 0;                                       // using frames? then take my.frame = Start frame;
   while (my.animation_frame < 100){
      my.animation_frame += time_step * 4;
      ent_animate (me, "die", my.animation_frame, NULL);
      wait (1);   
   }
   // end of new school anm die part...if you wanna use oldschool stuff:
   // copy n paste vertex - frame - stuff from above, delete my.animation_frame=0+the while, adjust frame numbers = done!
   set (my, TRANSLUCENT | PASSABLE); 
   my.alpha = 100; while (my.alpha > 0) { my.alpha -= time_step; wait (1); } // TRANSLUCENT and while = optional of course
   wait       (1);
   ptr_remove (me);
}



If it works, ill add this code to lite-c - contributions asap.
GreetsNPeace!


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Any clear working example ? [Re: rayp] #450337
04/12/15 23:48
04/12/15 23:48
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
i will give this a try laugh and let you know how it turns out.
It works laugh although the character somehow floats above the ground
so that's an issue ::)

Great work this is really usefull laugh


Last edited by Realspawn; 04/13/15 00:10.

Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: Any clear working example ? [Re: Realspawn] #450339
04/13/15 00:21
04/13/15 00:21
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Quote:
floats above the ground
You setup players BBOX correct be4?
If the level is a model, instead of "blocks", you set its
Code:
POLYGON

flag, yes?

Your welcome man.
Ill post it in2 contributions then btw.
Works? Cool! ...got a "scripting - run" last days grin


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Any clear working example ? [Re: rayp] #450340
04/13/15 00:35
04/13/15 00:35
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
I Pmmed you laugh

This stuff is excellent material laugh and deserves a place in the contribution section laugh


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: Any clear working example ? [Re: Realspawn] #450350
04/13/15 08:35
04/13/15 08:35
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Originally Posted By: Realspawn
although the character somehow floats above the ground so that's an issue ::)
cct (PH_CHAR) will float above the ground anyway, there is only XY movement in the example tongue it needs gravity code.

Greets


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Any clear working example ? [Re: 3run] #450351
04/13/15 09:13
04/13/15 09:13
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Quote:
it needs gravity code.
feel free todo ^^


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Any clear working example ? [Re: rayp] #450352
04/13/15 09:21
04/13/15 09:21
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Originally Posted By: rayp
Quote:
it needs gravity code.
feel free todo ^^
I have a special surprise coming out soon tongue

Best regards


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Any clear working example ? [Re: 3run] #450360
04/13/15 11:02
04/13/15 11:02
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
curious to see it and test it laugh rayp did give a good headstart laugh


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: Any clear working example ? [Re: Realspawn] #450363
04/13/15 11:40
04/13/15 11:40
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Here you go grin


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1