Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, ChrstphFr), 941 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
problem with rel_for_screen in A8.30.3, maybe bug? #384185
09/30/11 12:24
09/30/11 12:24
Joined: Jul 2004
Posts: 785
Serbia
Iglarion Offline OP
User
Iglarion  Offline OP
User

Joined: Jul 2004
Posts: 785
Serbia
I have problems with difference betwen old and new engine version. In some situation with 8.30.3 rel_for_screen and vec_to_screen not work, and i thinking it's maybe a bug?

I made example where rel_for_screen work good in some previous version (tested in 8.03.2) but not in new beta:
Code:
ENTITY panel_ent {
	type = "test_panel.mdl";
	VIEW = camera;
	flags = visible;
	layer = 14;
	pan = 35; tilt = 15; roll = -10;
}

var panel_distance[2] = 200,200;
var panel_distance_y[2] = 0,0;

function handle_panels_startup {
	while (1) {
		temp.x = 20 * screen_size.x/800;
		temp.y = (20 + panel_distance_y[1]) * screen_size.y/600;
		temp.z = panel_distance[1];
		rel_for_screen(temp.x,camera);
		vec_set(panel_ent.x,temp.x);
		wait(1);
	}
}

Now i have almost good results when i change rel_for_screen to vec_for_screen.

There also problem with vec_to_screen. I have different result in last beta. Here example where i check did entity is visible on screen, but this now not work like before:
Code:
vec_set(temp.x,vector(my.x,my.y,my.z + 5));
vec_to_screen(temp.x,camera);
if (temp.x < screen_size.x + 100 && temp.y < screen_size.y + 50 && vec_dist(my.x,vector(camera.x,0,camera.z)) < 1500){


I wonder why this happen?

Re: problem with rel_for_screen in A8.30.3, maybe bug? [Re: Iglarion] #385133
10/13/11 11:44
10/13/11 11:44
Joined: Jul 2004
Posts: 785
Serbia
Iglarion Offline OP
User
Iglarion  Offline OP
User

Joined: Jul 2004
Posts: 785
Serbia
...i still wonder this is a bug or...?


IGRAVISION Page - www.igravision.com
RPG project - The Battle For Forgol 92.75%
Re: problem with rel_for_screen in A8.30.3, maybe bug? [Re: Iglarion] #385138
10/13/11 12:40
10/13/11 12:40
Joined: May 2008
Posts: 257
D
djfeeler Offline
Member
djfeeler  Offline
Member
D

Joined: May 2008
Posts: 257
Hello,

you forgot the * behind ENTITY and the =

the good code is

Code:
ENTITY* panel_ent = {
	type = "test_panel.mdl";
	view = camera;
	flags = SHOW;
	layer = 14;
	pan = 35; tilt = 15; roll = -10;
}

var panel_distance[2] = {200,200};
var panel_distance_y[2] = {0,0};

function handle_panels_startup() {
	
	VECTOR temp;
	while(1) 
	{
		temp.x = 20 * screen_size.x/800;
		temp.y = (20 + panel_distance_y[1]) * screen_size.y/600;
		temp.z = panel_distance[1];
		rel_for_screen(temp.x,camera);
		vec_set(panel_ent.x,temp.x);
		wait(1);
	}
}



Djfeeler

Last edited by djfeeler; 10/13/11 12:50.
Re: problem with rel_for_screen in A8.30.3, maybe bug? [Re: djfeeler] #385139
10/13/11 13:00
10/13/11 13:00
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
As to answer the first question: Yes, rel_for_screen indeed behaved differently in the last beta - this will be corrected. But vec_to_screen is ok - we've looked into it to be sure. For checking an entity visibility, use the return value of vec_to_screen. Your method can only work when the entity is on the screen, but not when it is out of the screen, as then the screen coordinates are not guaranteed to be valid.

Re: problem with rel_for_screen in A8.30.3, maybe bug? [Re: djfeeler] #385140
10/13/11 13:02
10/13/11 13:02
Joined: Jul 2004
Posts: 785
Serbia
Iglarion Offline OP
User
Iglarion  Offline OP
User

Joined: Jul 2004
Posts: 785
Serbia
Thank you JCL, you help me a lot, now i understand what is problem in vec_to screen and i will update my old code! Also great to know that i do not need change anything in rel_for_screen, i will wait new update smile .

Thanks a lot!!

Last edited by Iglarion; 10/13/11 13:13.

IGRAVISION Page - www.igravision.com
RPG project - The Battle For Forgol 92.75%

Moderated by  old_bill, Tobias 

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