Camera question

Posted By: LPF

Camera question - 03/08/12 20:25

is it possible to tell the engine that it shouldn't render the part of the level that lies beyond a certain layer (like y < 100)
i mean to make it possible to see through a wall, that lies between the player and the camera and consits of wed level blocks and some models
Posted By: rayp

Re: Camera question - 03/08/12 20:36

Mhh. Maybe u can create a Map Entity (or model) of the levelpart. Then u could apply a script like this

Code:
action _Render_me_or_not()
{
 while(!player) wait(1); //wait for player entity
 while(1)
 {
    if (vec_dist(my.x,player.x) < 100) reset(my,INVISIBLE|PASSABLE);
    else set(my,INVISIBLE|PASSABLE);
   wait(2);
 }
}

This would set your levelpart invisible and passable if player is 100 away and show it when player is near.

Hope this helps?

Edit: If u mean that a wall gets invisible when camera is behind and player is infront, so that u can see the player. This is a bit more complicated. Never done it. Maybe u can make a c_trace from camera pos to see if it hits something. But that would mean, that u need to build your level with models or map entities cause i dont know a command to make blocks invisible. Maybe someone else.
Posted By: Espér

Re: Camera question - 03/08/12 20:51

my idea would be:
creating a new View, and set it behind walls when the player looks at one.
Create a second entity in front of your actual, and render the view on his textur bitmap with a bit transparent
Posted By: EvilSOB

Re: Camera question - 03/09/12 11:48

Here is an example of my variation of Esper's idea... in the flesh...

I will post a link to a complete demo of this code shortly...

Code:
BMAP*  STW_bmap = "#16x16x24";
PANEL* STW_pan  = { bmap=STW_bmap;  alpha=75;     flags = TRANSLUCENT | SHOW; }
VIEW*  STW_cam  = { bmap=STW_bmap;  clip_near=1;  flags = SHOW;               }

void see_thru_wall_updater()
{
	vec_set(STW_cam.x, camera.x);		vec_set(STW_cam.pan, camera.pan);
	if((STW_bmap.width!=screen_size.x)||(STW_bmap.height!=screen_size.y))
	{	
		STW_pan.bmap=STW_cam.bmap = NULL;
		bmap_purge(STW_bmap);		bmap_remove(STW_bmap);
		STW_bmap = bmap_createblack(screen_size.x, screen_size.y, 24);
		STW_pan.bmap = STW_cam.bmap = STW_bmap;
		STW_pan.size_x=screen_size.x;	STW_pan.size_y=screen_size.y;
	}
}


Posted By: EvilSOB

Re: Camera question - 03/09/12 12:01

OK. HERE is a link to the demo.

Its pretty crude at the moment, but it shows a promising proof-of-concept.

Ive got a few ideas for improvement Ive yet to try, but
because Im new to working with VIEWs, I am unable to estimate
what sort of horsepower this process is going to require.

I havent detected any noticable load, but as you can see, its
only a very simple level with only one active entity.

Ideas anyone?
Posted By: LPF

Re: Camera question - 03/09/12 12:59

am I allowed to use this in my game? i'm actually trying to understand it but i think i need a bit for this...

and it works as PERFECT as i whished laugh

Posted By: EvilSOB

Re: Camera question - 03/09/12 13:06

Hell yeah, I wrote it for YOU as a mental exercise for myself.

If youve got any question about what its doing, or why, just ask here...


[edit] I will probably have further improvements and or suggestions
later on, so stay tuned...

At the moment, its a bit ugly... especially the floor being clipped...


Posted By: LPF

Re: Camera question - 03/09/12 13:32

not really... it's o.k. like that

if you want i could post the project here...


Posted By: EvilSOB

Re: Camera question - 03/09/12 13:44

Nah, its cool dude.

The other ideas for improving it Ive had so far have all been a bust.

So if you're happy, that will do...
© 2024 lite-C Forums