A 3D entity MDL as a Panel "life meter"

Posted By: Ericmor

A 3D entity MDL as a Panel "life meter" - 05/18/10 21:37

Panels only use bitmaps, i was under the impression that it could be used with an entity 3d mdl model too.

I wanted to start with an 3D animated life meter, but i simply couldn't find ANY template or related function to make a 3d entity placed on top of all rendered elements in a view.

I even made a 3D animated life meter.



I could swear that this was possible... am i hallucinating?

keeping the life meter as a normal 3d scene entity in a specific position to the camera will imply on it getting stuck inside map entityes and other models during exploration - not cool.

I was planning on making all menus in a 3D fashion - equiping the character with a rotating 3d avatar oblivion-style, etc...

Maybe the solution is to enclose the menu elements in a separate 'room' with a camera, and render them in an extra view ontop of the main view like a car mirror?
Posted By: Superku

Re: A 3D entity MDL as a Panel "life meter" - 05/18/10 21:42

You are looking for view entities, here an example from the manual:

ENTITY* compass_panel =
{
type = "compass.mdl";
layer = 2; // display above panels with layer 1
flags2 = SHOW; // visible on screen from the start x = 100; // place 100 quants ahead of the view
y = -50; // 50 to the right
z = 0; // and center vertically
}

EDIT: @Uhrwerk: Hehe, I was looking for that page. Btw. how to search the online manual?
Posted By: Uhrwerk

Re: A 3D entity MDL as a Panel "life meter" - 05/18/10 21:43

Just define the entity as a view entity and give it a high layer.

http://www.conitec.net/beta/aent_createlayer.htm

EDIT: :PPP
Posted By: Ericmor

Re: A 3D entity MDL as a Panel "life meter" - 05/18/10 22:47

Agh, the explanation in the standard syntax manual made it appear like a SKY model only instruction... damn, i KNEW something was wrong :S
The 'entity*...' example code doesn't work fot me(Gamestudio crashes right in the loading), is that Lite C? I'm using wdl on my game frown
Thanks for the info, guys... now to create a code to place the damn .mdl as a life meter while mixing the animation frames correctly...
Thanks again.
Posted By: Uhrwerk

Re: A 3D entity MDL as a Panel "life meter" - 05/18/10 23:41

Yes, the example is Lite-C. But there is an example for C-Script in the manual right under the entry "Entities".
Posted By: Ericmor

Re: A 3D entity MDL as a Panel "life meter" - 05/19/10 02:09

LOL, i managed!



This is what i came up with:

Code:
function create_LIFE_METER()
{
	if(LIFE_METER!=null){return;}
	LIFE_METER = ent_createlayer("LIFE_METER.mdl",0,2);
	life_meter();
	return;
}

function life_meter()
{
  while(LIFE_METER==null||camera_arrow_1==null){wait(1);}
  
LIFE_METER.y = 180; 
LIFE_METER.z = 100;
LIFE_METER.x = 366; 
LIFE_METER.pan = 300;
LIFE_METER.scale_x = 0.5;
LIFE_METER.scale_y = 0.5;
LIFE_METER.scale_z = 0.5;
return;	
}



And there's even a small routine to shrink it back and forth from the top view:

Code:
var LIFE_METER_size=0;
var LIFE_METER_taswitch=0;
on_j = LIFE_METER_MOVES();

function LIFE_METER_MOVES()
{
 if(LIFE_METER_taswitch==1){return;}
 while(1)
 {
 	if(LIFE_METER_size==0)
 	 { if(LIFE_METER_taswitch==0){LIFE_METER_taswitch=1;}
 	   if(LIFE_METER.scale_x<1.0){LIFE_METER.scale_x+=0.1* time_step;}
 	   if(LIFE_METER.scale_y<1.0){LIFE_METER.scale_y+=0.1* time_step;}
 	   if(LIFE_METER.scale_z<1.0){LIFE_METER.scale_z+=0.1* time_step;}
 	   if(LIFE_METER.y>=150){LIFE_METER.y-=7*time_step;}
 	   if(LIFE_METER.z>=81){LIFE_METER.z-=5*time_step;}
 	   if(LIFE_METER.tilt>=0 && LIFE_METER_taswitch==1){LIFE_METER.roll+=30*time_step;}
 	   if(LIFE_METER.tilt>=25 && LIFE_METER_taswitch==1){LIFE_METER_taswitch=2;}
 	   if(LIFE_METER.tilt>0 && LIFE_METER_taswitch==2){LIFE_METER.roll-=30*time_step;}
 	   if(LIFE_METER.tilt<=0 && LIFE_METER_taswitch==2){LIFE_METER_taswitch=1;}
 	   if(LIFE_METER.scale_x>=1.0){LIFE_METER.scale_x=1.0;LIFE_METER.scale_y=1.0;LIFE_METER.scale_z=1.0;LIFE_METER.y=150;LIFE_METER.z=80;LIFE_METER_size=1;LIFE_METER.roll = 0;LIFE_METER_taswitch=0;return;}
 	 }
 	 
 	 if(LIFE_METER_size==1)
 	 { if(LIFE_METER_taswitch==0){LIFE_METER_taswitch=1;}
 	   if(LIFE_METER.scale_x>0.5){LIFE_METER.scale_x-=0.1* time_step;}
 	   if(LIFE_METER.scale_y>0.5){LIFE_METER.scale_y-=0.1* time_step;}
 	   if(LIFE_METER.scale_z>0.5){LIFE_METER.scale_z-=0.1* time_step;}
 	   if(LIFE_METER.y<=180){LIFE_METER.y+=7*time_step;}
 	   if(LIFE_METER.z<=100){LIFE_METER.z+=5*time_step;}
 	   if(LIFE_METER.tilt>=0 && LIFE_METER_taswitch==1){LIFE_METER.roll-=30*time_step;}
 	   if(LIFE_METER.tilt<=-25 && LIFE_METER_taswitch==1){LIFE_METER_taswitch=2;}
 	   if(LIFE_METER.tilt<0 && LIFE_METER_taswitch==2){LIFE_METER.roll+=30*time_step;}
 	   if(LIFE_METER.tilt>=0 && LIFE_METER_taswitch==2){LIFE_METER_taswitch=1;}
 	   if(LIFE_METER.scale_x<=0.5){LIFE_METER.scale_x=0.5;LIFE_METER.scale_y=0.5;LIFE_METER.scale_z=0.5;LIFE_METER.y=180;LIFE_METER.z=100;LIFE_METER_size=0;LIFE_METER.roll = 0;LIFE_METER_taswitch=0;return;}
 	 }
 	 wait(1);
} 	
 }



Thanks again for the quick help folks!
Posted By: Uhrwerk

Re: A 3D entity MDL as a Panel "life meter" - 05/19/10 02:12

Looks cool. It's maybe just a little to big in proportion to the very slim character. Glad we could help. :-)
Posted By: Ericmor

Re: A 3D entity MDL as a Panel "life meter" - 05/19/10 02:20

That's were the LIFE_METER shrink function comes in hand laugh
Uh... actually, i'm using a wide monitor, and gamestudio is somehow capturing screenshots with that resolution distortion... real screen is a bit more stretched back here.
I'm also placing a 'benchmark' level start in the game when it first runs, so the player can select screen and detail resolutions according to his/her tastes.
Posted By: badapple

Re: A 3D entity MDL as a Panel "life meter" - 05/19/10 02:27

looks excellent , did you make all the content? it reminds me of quest64 for some reason , great work so far.
Posted By: Widi

Re: A 3D entity MDL as a Panel "life meter" - 05/19/10 05:52

Yes, all pictures from you looks great. Keep on your work...
Posted By: Blink

Re: A 3D entity MDL as a Panel "life meter" - 05/19/10 22:56

very cool, good luck. it reminds me of zelda games for some reason.
Posted By: Ericmor

Re: A 3D entity MDL as a Panel "life meter" - 05/20/10 01:16

LOl, i actually had LANDSTALKER in my mind on the first prototypes tongue
© 2024 lite-C Forums