Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (TipmyPip, AndrewAMD, dBc), 18,430 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
view for entity #420350
03/24/13 09:47
03/24/13 09:47
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
I wanted to view particular entities on the additional view, as it was suggested by Superk:
Originally Posted By: Superku
VIEW* my_view with NOENT and NOWORLD set, then after level_load
my_view.genius = ent_create(NULL,nullvector,NULL); //or any other entity
and finally set every entity's parent pointer to my_view.genius which should be rendered by that view.
But I somehow face the problem, that parent entity isn't rendered on the view...
Code:
VIEW* my_view;

action testView(){
	while(!my_view.genius){ wait(1); }
	set(my, TRANSLUCENT);
	my_view.genius.parent = my;
}

void main(){	
	my_view = view_create(5);	
	my_view.pos_x = my_view.pos_y = 10;	
	my_view.size_x = my_view.size_y = 256;	
	set(my_view, SHOW | NOENT);
	
	level_load("map01.wmb");
	wait(-1);
	
	my_view.genius = ent_create(NULL, nullvector, NULL);
	
	while(1){
		
		vec_set(my_view.x, camera.x);
		vec_set(my_view.pan, camera.pan);
		wait(1);
	}
}

When I run this code, it only renders the level blocks, but still, the parent entity isn't visible..
Here is the screen:


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: view for entity [Re: 3run] #420351
03/24/13 10:21
03/24/13 10:21
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
I'm not sure, but as far as I know view.genius depends on whether the camera is outside or inside the .genuis-entity.

Try this:
- Use BOX_MDL as view.genius with PASSABLE and UNTOUCHABLE so it doesn't affect anything (you need a mesh. the camera can't be inside an empty model)
- Set view.genius.xyz to camera.xyz (camera is inside the genius model)
- Test it, and if it doesn't work, try the same but now with the camera outside of the view.genius


POTATO-MAN saves the day! - Random
Re: view for entity [Re: Kartoffel] #420352
03/24/13 10:26
03/24/13 10:26
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
I guess genius works in reverse way, if NOENT was set for the view.
Quote:
The NOENT flag can be used to reverse the genius clipping and suppress all other entities.
Anyway, I tried both methods, but none of them works. But I can see the genius model itself, but not parents.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: view for entity [Re: 3run] #420354
03/24/13 10:30
03/24/13 10:30
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
so you set:

camera.genius = [the box model, as I've said];
[your 3 other boxes].parent = [the box model];

??


POTATO-MAN saves the day! - Random
Re: view for entity [Re: Kartoffel] #420355
03/24/13 10:34
03/24/13 10:34
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
No, I set:
Code:
// to create genius pointer:
my_view.genius = ent_create(CUBE_MDL, nullvector, NULL);	
set(my_view.genius, PASSABLE);

// to assign the parent pointer:
my_view.genius.parent = my;

And I actually do that only for one box (as you see in my first post, I use TRANSLUCENT for that entity).


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: view for entity [Re: 3run] #420356
03/24/13 10:39
03/24/13 10:39
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
You did it the other way around grin

The view.genius has to be the parent so that all 'child-entities' will have the same behaviour.

you have to use:
entity.parent = view.genius;
not
view.genius.parent = entity;


POTATO-MAN saves the day! - Random
Re: view for entity [Re: Kartoffel] #420357
03/24/13 10:44
03/24/13 10:44
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Well... shit happens grin
It works now, here is the example:
Code:
VIEW* my_view;

action testView(){
	while(!my_view.genius){ wait(1); }
	set(my, TRANSLUCENT);
	my.parent = my_view.genius;
}

void main(){	
	my_view = view_create(5);	
	my_view.pos_x = my_view.pos_y = 10;	
	my_view.size_x = my_view.size_y = 256;	
	set(my_view, SHOW | NOENT);
	
	level_load("map01.wmb");
	wait(-1);
	
	my_view.genius = ent_create(CUBE_MDL, nullvector, NULL);	
	set(my_view.genius, PASSABLE);
	
	while(1){
		
		vec_set(my_view.x, camera.x);
		vec_set(my_view.pan, camera.pan);
		wait(1);
	}
}

And screen:

Manual unfortunately lacks of examples for some features.. Thank you.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: view for entity [Re: 3run] #420358
03/24/13 10:45
03/24/13 10:45
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Nevermind, and thanks for posting the working code wink

EDIT: maybe it also works with NULL as genius model, but I'm not sure.
EDIT2: not view.genius = NULL; but view.genius = ent_create(NULL, ...);

Last edited by Kartoffel; 03/24/13 10:57.

POTATO-MAN saves the day! - Random
Re: view for entity [Re: Kartoffel] #420380
03/24/13 19:59
03/24/13 19:59
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Kartoffel@ yes, it works like a charm, here it the working (tested) code:
Code:
VIEW* my_view;

action testView(){
	while(!my_view.genius){ wait(1); }
	set(my, TRANSLUCENT);
	my.parent = my_view.genius;
}

void main(){	
	my_view = view_create(5);	
	my_view.pos_x = my_view.pos_y = 10;	
	my_view.size_x = my_view.size_y = 256;	
	set(my_view, SHOW | NOENT);
	
	level_load("map01.wmb");
	wait(-1);
	
	my_view.genius = ent_create(NULL, nullvector, NULL);	
	
	while(1){
		
		vec_set(my_view.x, camera.x);
		vec_set(my_view.pan, camera.pan);
		wait(1);
	}
}



Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: view for entity [Re: 3run] #420381
03/24/13 20:04
03/24/13 20:04
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Neat! wink

Btw. when you load a new level, it may be necessary to set my_view.genius to NULL before level_load if this is not done automatically or the pointer assignment in testView will fail/ lead to the wrong pointer. I am not sure though, I/ someone would need to test this.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

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

Gamestudio download | 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