|
Re: mirror view on a car game
[Re: 3run]
#354515
01/19/11 15:35
01/19/11 15:35
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
Serious User
|
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
in the next GS version there will be a mirror example on the knight on wheels sample. If you don't want to wait you can add a second view and assing it a bmap, then add a panel with that bmap
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: mirror view on a car game
[Re: painkiller]
#354705
01/21/11 08:28
01/21/11 08:28
|
Joined: Aug 2008
Posts: 81
jpxtreme
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2008
Posts: 81
|
@painkiller do you have an example code that I can start or study with in how to assign second view on a bmap.
EDIT
I've read the manual about view.bmap and bmap_for_entity and I attempt to try the code like this
//CAR MIRROR VIEW* carmirror_view = { flags = VISIBLE; }
PANEL* mirror_pan = { pos_x = 100; pos_y = 0; layer = 1; bmap = "mirror_middle.bmp";
}
on my main...
carmirror_view.bmap = bmap_for_entity(mirror_pan,0); set(mirror_pan,VISIBLE);
but it won't run.
Could you guide me how to do it properly.
Last edited by jpxtreme; 01/21/11 09:31.
|
|
|
Re: mirror view on a car game
[Re: jpxtreme]
#354739
01/21/11 15:23
01/21/11 15:23
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
Serious User
|
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
Here it's an example:
BMAP* mirror_bmap;
PANEL* mirror_panel;
VIEW* mirror_view;
function handle_mirror()
{
while(!player) wait(1);
mirror_bmap=bmap_createblack(512, 128, 24);
mirror_panel=pan_create("bmap=mirror_bmap", 0);
mirror_view=view_create(1);
mirror_view.clip_far=2000;
mirror_view.aspect=-1;
mirror_view.size_x=512;
mirror_view.size_y=128;
mirror_panel.pos_x=0.5*screen_size.x-256;
mirror_view.arc=90;
mirror_view.bmap=mirror_bmap;
set(mirror_view, NOSHADOW|UNTOUCHABLE|SHOW|NOLOD);
set(mirror_panel, SHOW);
while(player)
{
vec_set(mirror_view.x, vector(-75, 0, 14));
vec_rotate(mirror_view.x, player.pan);
vec_add(mirror_view.x, player.x);
vec_set(mirror_view.pan, player.pan);
mirror_view.pan+=180;
mirror_view.roll+=180;
wait(1);
}
}
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: mirror view on a car game
[Re: painkiller]
#354947
01/23/11 15:24
01/23/11 15:24
|
Joined: Aug 2008
Posts: 81
jpxtreme
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2008
Posts: 81
|
I tried put handle_mirror(); function inside my action car() but when I start the game it only displays black border. Am I doing it wrong? please help.
Last edited by jpxtreme; 01/23/11 15:25.
|
|
|
Re: mirror view on a car game
[Re: jpxtreme]
#354963
01/23/11 17:29
01/23/11 17:29
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
Serious User
|
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
you need to put it after your level load in main funcion:
......
level_load(blablah);
handle_mirror();
......
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: mirror view on a car game [SOLVED]
[Re: painkiller]
#355031
01/24/11 11:10
01/24/11 11:10
|
Joined: Aug 2008
Posts: 81
jpxtreme
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2008
Posts: 81
|
thank you painkiller for giving me the idea. I've made it to work using your code but need to modify it a bit. this is what I got so far... this is for lite c only, not yet tested in cscript. BMAP* mirror_bmap; PANEL* mirror_panel;
VIEW* mirror_view = { layer = 10; size_x = 400; size_y = 150; pos_x = 300; pos_y = 20; flags = VISIBLE; }
function handle_mirror() { while (!player) {wait (1);} camera.portal = mirror_view;
mirror_view.fog_start = 0.8 * camera.clip_far; // fog starts at 80% of clip range mirror_view.fog_end = 0.9 * camera.clip_far; // total foggy at 90% of clip range mirror_view.arc=90; set(mirror_view, NOSHADOW|UNTOUCHABLE|VISIBLE); while (1) { proc_kill(4); mirror_view.genius = camera.genius; mirror_view.aspect = camera.aspect; mirror_view.arc = -camera.arc; mirror_view.x = camera.x; mirror_view.y = camera.portal_y - (abs(camera.portal_y - camera.y)); mirror_view.z = camera.z; mirror_view.pan = -camera.pan; mirror_view.tilt = camera.tilt; mirror_view.roll = camera.roll; wait(1); }
}
function main() { level_load(mylevel) wait(1); handle_mirror(); }
and this is the output... this will help out others too. thanks!
Last edited by jpxtreme; 01/24/11 11:20.
|
|
|
|