Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Ayumi), 662 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
mirror view on a car game #354476
01/19/11 04:21
01/19/11 04:21
Joined: Aug 2008
Posts: 81
J
jpxtreme Offline OP
Junior Member
jpxtreme  Offline OP
Junior Member
J

Joined: Aug 2008
Posts: 81
how do I achieve this in my car game? A panel which serves as a mirror view. Maybe a separate camera that is attached in a panel.is this possible?

Re: mirror view on a car game [Re: jpxtreme] #354481
01/19/11 08:45
01/19/11 08:45
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Just create one more view, set it to the car position and then rotate its PAN with players PAN minus 180.
Make car genius to that view, and thats it.
I think this will be the easiest part of making car game...


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: mirror view on a car game [Re: 3run] #354489
01/19/11 09:47
01/19/11 09:47
Joined: Aug 2008
Posts: 81
J
jpxtreme Offline OP
Junior Member
jpxtreme  Offline OP
Junior Member
J

Joined: Aug 2008
Posts: 81
thank you for your reply. But it would be easier for me to understand by citing an example or sample code. or if you have one kindly refer a link to me. I'm a newbie in 3dgs hope you understand.

Re: mirror view on a car game [Re: jpxtreme] #354497
01/19/11 11:17
01/19/11 11:17
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
I can't help you with an example ATM, cause I'm not able to use my PC.
Look at the manual, there is everything that you need about VIEW's


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
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 Offline
Serious User
painkiller  Offline
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
J
jpxtreme Offline OP
Junior Member
jpxtreme  Offline OP
Junior Member
J

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 Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
Here it's an example:

Code:
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
J
jpxtreme Offline OP
Junior Member
jpxtreme  Offline OP
Junior Member
J

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 Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
you need to put it after your level load in main funcion:

Code:
......
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
J
jpxtreme Offline OP
Junior Member
jpxtreme  Offline OP
Junior Member
J

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

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.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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