model as a view... why it can't be viewed?

Posted By: boyax

model as a view... why it can't be viewed? - 07/30/09 11:20

My problem is initializing the arrow model in which i can't see it...

I'm trying to put an arrow model that would point to the obstacle in my level. Hence, as i've tried to have a small test it will display.

sample output:


but, when i ported it to my game project, I can't see the arrow model? it should always be on mid-top on the screen.
I've already make sure the vector & the layer set are visible to the camera at start.

Here's some code:
Code:
function arrow_init()
{
 while(player == NULL){ wait(1); }
		
  ent_arrow = ent_createlayer("arrow.mdl", 0, 2);

  //pose and orientate it	
  if(ent_arrow  != NULL)
  {	
    vec_set(ent_arrow.x, vector(-20000,12224,16640));		
    if(NULL != vec_to_screen(ent_arrow, camera))  //just to check if it's visible
     {
	ent_arrow->tilt = 180; //see rotation code; init rotation	
     }

   }	
}




Any idea? I'm not sure if missed something. Thanks
Posted By: boyax

Re: model as a view... why it can't be viewed? - 07/31/09 08:47

I'm still stucked with this... anyone?

by the way, the arrow model should be part of the view... since it will always display.
Posted By: SchokoKeks

Re: model as a view... why it can't be viewed? - 07/31/09 11:17

your coordinates (vector(-20000,12224,16640)) are wrong. the coordinates of a layer or view entity are relative to the camera! so your arrow must be very very far away from the camera so that its too small to see.

try something like vector (100, 0, 50)

the first value (x) is the distance to the camera,
the second one (y) is left/right
and the third one (z) is up/down

hope that helps!
- SchokoKeks
Posted By: boyax

Re: model as a view... why it can't be viewed? - 07/31/09 12:02

got it! I've just knew the coordinates of the layer are relative to the camera... I haven't seen this in the manual.

Thanks for the help. smile
© 2024 lite-C Forums