2 registered members (AndrewAMD, Nymphodora),
485
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
[SOLVED] Text at a bone of a VIew-Entity / problem
#402601
06/07/12 14:17
06/07/12 14:17
|
Joined: Jun 2008
Posts: 402 Germany
sebbi91
OP
Senior Member
|
OP
Senior Member
Joined: Jun 2008
Posts: 402
Germany
|
Hi guys, I have a problem to set the position of a Text to a bone of a View-Entity. Here is a Code-Snippet of my try to make it work. //The View-Entity ENTITY* user_menu= { type = "user_menu.mdl"; layer=2; flags = SHOW|LIGHT|SHADOW; flags2 =VISIBLE; }
//Give View-Entitys a position void activate_panels_startup() { user_menu.x=100; // deep user_menu.y=-50; // X_screen user_menu.z=15; // Y_screen ... }
//my Text TEXT* txt_build = { font=main_txt; layer = 5; string (user_menue_build); flags = TRANSLUCENT | SHOW | ARIGHT; }
//my programm to set the Position void activate_Textes_startup() { VECTOR text_pos1; vec_for_bone(text_pos1,user_menu,"Bone1"); vec_to_screen (text_pos1,camera1); txt_build.pos_x=text_pos1.x; txt_build.pos_y=text_pos1.y; }
The Text appears but not at the Bone Position. Any Idea? Sorry if this is too easy and also sorry for my english^^. Have a nice day. best regards Sebb
Last edited by sebbi91; 06/10/12 14:55. Reason: solved
3D-Gamestudio A8 - Commercial
|
|
|
Re: Text at a bone of a VIew-Entity / problem
[Re: sebbi91]
#402607
06/07/12 15:42
06/07/12 15:42
|
Joined: Oct 2002
Posts: 2,256 Oz
Locoweed
Expert
|
Expert
Joined: Oct 2002
Posts: 2,256
Oz
|
It looks ok. you might show where you set camera1 to be the current view. Don't see that in the code.
You can also try:
if(vec_to_screen (text_pos1,camera1) != NULL) { txt_build.pos_x=text_pos1.x; txt_build.pos_y=text_pos1.y; } else { while(1) { draw_text("Position was not on screen",0,0,vector(225,0,0)); wait(1); } }
Or something like that to make sure that the vec_for_screen() position is actually even on the screen area.
You might also take out the ARIGHT flag and test without that.
Loco
Professional A8.30 Spoils of War - East Coast Games
|
|
|
Re: Text at a bone of a VIew-Entity / problem
[Re: Locoweed]
#402612
06/07/12 16:29
06/07/12 16:29
|
Joined: Jun 2008
Posts: 402 Germany
sebbi91
OP
Senior Member
|
OP
Senior Member
Joined: Jun 2008
Posts: 402
Germany
|
Hmm I tryied it but it doesn't work. the "Error-message" doesnt apear so it seems there is another mistake in my code. But also thanks for your try. I'll Post the whole camera code now: Maybe is there the reason. //splitted views VIEW* camera1= //camera player1 { layer=15; arc=110; } VIEW* camera2= //camera player2 { layer=15; arc=110; }
//Set the camera positions void camera_and_HUD_startup() { while(1) { reset(camera0,SHOW); set(camera1,SHOW); set(camera2,SHOW); camera1.pos_x=0; camera1.pos_y=0; camera1.size_x=screen_size.x; camera1.size_y=screen_size.y/2; camera2.pos_x=0; camera2.pos_y=screen_size.y/2; camera2.size_x=screen_size.x; camera2.size_y=screen_size.y/2; ... wait(1) } }
//The View-Entity ENTITY* user_menu= { type = "user_menu.mdl"; layer=2; flags = SHOW|LIGHT|SHADOW; flags2 =VISIBLE; }
//Give View-Entitys a position void activate_panels_startup() { user_menu.x=100; // deep user_menu.y=-50; // X_screen user_menu.z=15; // Y_screen ... }
//my Text TEXT* txt_build = { font=main_txt; layer = 5; string (user_menue_build); flags = TRANSLUCENT | SHOW | ARIGHT; }
//my programm to set the Position void activate_Textes_startup() { VECTOR text_pos1; vec_for_bone(text_pos1,user_menu,"Bone1"); vec_to_screen (text_pos1,camera1);
if(vec_to_screen (text_pos1,camera1) != NULL) { txt_build.pos_x=text_pos1.x; txt_build.pos_y=text_pos1.y; } else { while(1) { draw_text("Position was not on screen",0,0,vector(225,0,0)); wait(1); } }
}
Thanks anyway
3D-Gamestudio A8 - Commercial
|
|
|
Re: Text at a bone of a VIew-Entity / problem
[Re: MasterQ32]
#402653
06/08/12 15:02
06/08/12 15:02
|
Joined: Jun 2008
Posts: 402 Germany
sebbi91
OP
Senior Member
|
OP
Senior Member
Joined: Jun 2008
Posts: 402
Germany
|
thx for your reply but it doesnt work. The text is in the top left corner now. Maybe I did something wrong. Here is my modified code. I marked the Vector Funktions. I think there is a misstake in it. void activate_Textes_startup() { while(1) {
VECTOR text_pos1; vec_for_bone(text_pos1,user_menu,"build"); rel_for_screen(text_pos1,camera1); txt_build.pos_x=text_pos1.x; txt_build.pos_y=text_pos1.y; wait(1); } }
thanks anyway. Have a nice day.
3D-Gamestudio A8 - Commercial
|
|
|
Re: Text at a bone of a VIew-Entity / problem
[Re: sebbi91]
#402771
06/10/12 09:48
06/10/12 09:48
|
Joined: Jun 2008
Posts: 402 Germany
sebbi91
OP
Senior Member
|
OP
Senior Member
Joined: Jun 2008
Posts: 402
Germany
|
Please is there anyone, who can helps me? I really need this stuff working to work on my project.
Thanks in andvance.
3D-Gamestudio A8 - Commercial
|
|
|
Re: Text at a bone of a VIew-Entity / problem
[Re: sebbi91]
#402776
06/10/12 11:01
06/10/12 11:01
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
Expert
|
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
oh i'm sorry try rel_to_screen if it's a view entity or vec_to_screen if it's a world entity wrong direction, you converted from screen pos to world position
|
|
|
Re: Text at a bone of a VIew-Entity / problem
[Re: MasterQ32]
#402779
06/10/12 11:44
06/10/12 11:44
|
Joined: Jun 2008
Posts: 402 Germany
sebbi91
OP
Senior Member
|
OP
Senior Member
Joined: Jun 2008
Posts: 402
Germany
|
Thanks for the try, but now the Text is out of the screen. hmmmm..... I tryied some stuff to handle it, but it doesnt work. I uploaded a Bughuntingfile. "Download" If you could give it a try, I would be very happy. Thanks anyway, best regards sebb
3D-Gamestudio A8 - Commercial
|
|
|
Re: Text at a bone of a VIew-Entity / problem
[Re: Ch40zzC0d3r]
#402813
06/10/12 14:54
06/10/12 14:54
|
Joined: Jun 2008
Posts: 402 Germany
sebbi91
OP
Senior Member
|
OP
Senior Member
Joined: Jun 2008
Posts: 402
Germany
|
Thanks for your help. Now it works perfectly. For everyone who need this too. The misstake was there: void activate_Textes_startup() { while(1) { VECTOR text_pos1; vec_for_bone(text_pos1,user_menu,"build"); vec_to_screen (text_pos1.x,camera1); wait(1); } }
it has to be: void activate_Textes_startup() { while(1) { VECTOR text_pos1; vec_for_bone(text_pos1,user_menu,"build"); vec_to_screen (text_pos1.x,camera); wait(1); } }
It seems, that this only works with the regular camera. An you have to remove the reset(camera,SHOW|AUDIBLE); in the main-function. Thank you all. Have nice Evening. best regards Sebb
3D-Gamestudio A8 - Commercial
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|