Hey all,
can anyone help me or explain to me the interact2d function? I'm trying to put an object on screen but I cant get it in the right place.
this is sort of what i want to do: A 2 polygon plane that fits nicely into a radar frame. (radar frame is blitted on screen)
for example using a screen size of 800x480, the radar frame is always an 8th of the size of the frame buffer width (100 x 100) so the middle point where the radar object should be positioned is half of that (50 x50)
It's not a pivot problem but the radar object is a child of the player object and the camera is offset from the player
ui_frame_pos_x = (fb.height/16);// gives us the middle of the radar frame
ui_frame_pos_y = (fb.heigth/16);
SimpleVector dir=Interact2D.reproject2D3D(camera, fb, ui_frame_pos_x,ui_frame_pos_y).normalize();
RadarObject.clearTranslation();
RadarObject.translate(dir);
but that doesnt work, the radar object appears to be positioned at (150x0)
this does work (sort of) it's roughly in the right place but I cant accept that this is right:
SimpleVector dir=Interact2D.reproject2D3D(cam, fb, (-ui_frame_size_x+(ui_frame_size_x/2))+8, (ui_frame_size_y+ui_frame_size_x/2));
also, when my screen is 1024 wide, the above formula doesnt work and I need to do this, which is absolutely crazy:
SimpleVector dir=Interact2D.reproject2D3D(cam, fb, (-ui_frame_size_x)-(ui_frame_size_x/2)-(ui_frame_size_x/16), ui_frame_size_y+(ui_frame_size_y/2)-(ui_frame_size_y/16)).normalize();
So I dont think i'm doing it right. I have considered doing a lookup table for screen sizes but that's my last resort.
Any help much appreciated
Wouldn't it be better to put the radar object in a separate world, decouple it from the player, position it once and leave it alone? Or isn't that an option for some reason?
Never even considered doing it like that. works perfectly. thanks