|
view for entity
#420350
03/24/13 09:47
03/24/13 09:47
|
Joined: May 2009
Posts: 5,377 Caucasus
3run
OP
Senior Expert
|
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: 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...
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: 
|
|
|
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
Expert
|
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
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,377
Caucasus
|
I guess genius works in reverse way, if NOENT was set for the view. 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.
|
|
|
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
Expert
|
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
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,377
Caucasus
|
No, I set:
// 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).
|
|
|
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
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
You did it the other way around  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
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,377
Caucasus
|
Well... shit happens  It works now, here is the example:
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.
|
|
|
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
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
Nevermind, and thanks for posting the working code  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
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,377
Caucasus
|
Kartoffel@ yes, it works like a charm, here it the working (tested) 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);
}
}
|
|
|
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
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Neat!  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
|
|
|
|