1 registered members (AndrewAMD),
1,369
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Maths trig problem, angle to camera
[Re: MrGuest]
#341590
09/18/10 12:22
09/18/10 12:22
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
I give up... The trig is too evil for me...
Sorry dude... Bit I would try making them layer-entities, or rotating them in MED. But I dont know if thats useful 'deeper' into the project...
Maybe some trig-guru can help...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Maths trig problem, angle to camera
[Re: MrGuest]
#341613
09/18/10 16:56
09/18/10 16:56
|
Joined: Sep 2003
Posts: 5,900 Bielefeld, Germany
Pappenheimer
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
|
What if you don't use vec_for_screen and vec_to_screen, but simply the camera's position and rotation as reference? To prevent the models from moving while the camera's tilt is changing, save the camera's initial rotation into a vector that you use for positioning the models. Then switch between two states, one for placing a model, and the other for changing the camera's tilt, or whatever the other actions within the game are needed.
|
|
|
Re: Maths trig problem, angle to camera
[Re: Pappenheimer]
#341616
09/18/10 17:03
09/18/10 17:03
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Ideally I wanted the grid to be a perspective projection rather than isometric as there would be 1st person elements in it later. What do you mean, 1st person elements in the background of your grid? If so, then you could use a second view that is ISOMETRIC to draw your grid without painting a background color using NOSKY. Then just put the view on top (layer > 0) of the camera view and you are done!
"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
|
|
|
Re: Maths trig problem, angle to camera
[Re: Superku]
#341625
09/18/10 19:05
09/18/10 19:05
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Heres my idea of a layer-entity version. Im pretty sure the angles are correct because the yellow parts are fully exposed. BUT, it seems the angles required make the tiles look a little oddly-placed. Here is the code I came up with. (Ive chopped out almost all your original code and commented bits for ease of reading)
void hand_create(){
while(int_gameState == gameState_change){ wait(1); }
int i; for(i = 0; i < hand_max; i++)
{
ent_gameHand[i] = ent_createlayer("tile.mdl", NULL, NULL);
vec_set(ent_gameHand[i].x, vector(500, sin(i*60)*180, cos(i*60)*180));
ent_gameHand[i].pan = atanv(ent_gameHand[i].y/ent_gameHand[i].x)-90;
ent_gameHand[i].roll = 90+atanv(ent_gameHand[i].z/ent_gameHand[i].x);
vec_fill(ent_gameHand[i].scale_x, 4.5);
ent_cloneskin(ent_gameHand[i]);
}
}
FYI :: Shadows dont appear on view entities either, I just noticed...
Last edited by EvilSOB; 09/18/10 19:06.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Maths trig problem, angle to camera
[Re: EvilSOB]
#341637
09/18/10 22:14
09/18/10 22:14
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
OP
Serious User
|
OP
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
What if you don't use vec_for_screen and vec_to_screen, but simply the camera's position and rotation as reference? Definately possible, it's what I initially tried before the vec_for_screen, but still had the same problems calculating the entities position relative to the cameras position and angle. use a second view that is ISOMETRIC to draw your grid without painting a background color using NOSKY. Then just put the view on top (layer > 0) of the camera view and you are done! Didn't know this was possible, going to try that after Evil's latest post. Evil, thanks again for this, I was aware the entity would be slightly tilted inwards and it's almost perfect. Only problem with this is mouse_ent doesn't recognise view entities; I've tried resetting UNTOUCHABLE but still unfortunately didn't make any difference. I'm going to try Superku's solution and hopefully won't have too great an impact on FPS. Thanks again. Thanks all!
|
|
|
|