[SOLVED] vec_for_screen camera shaking

Posted By: Reconnoiter

[SOLVED] vec_for_screen camera shaking - 05/30/16 12:04

Hi,

I use vec_for_screen to position several entities for the game interface.
But for some reason the vec_for_screen line in the code below results in that the entity constantly switches position a bit (as if it is a vibrator lol grin ). camera constantly changes position. crazy

Code:
while(1) {
vec_set(my.x, vector(50, 50, 0)); // x/y test values
my.z = 50; //depth
vec_for_screen(my.x, camera);
vec_set(my.pan, camera.pan);
wait(1);
}



Besides that shaking, the camera itself stands still by the way.
If I comment the line "vec_for_screen(my.x, camera);" out, the problem goes away. But I would like to use vec_for_screen obviously.
Posted By: Reconnoiter

Re: vec_for_screen camera shaking - 05/30/16 13:16

Oh stupid me, the inventory slots were catched by a trace for the camera code. smirk
I will leave this thread here cause I quess its easy to make this mistake.
Posted By: rayp

Re: vec_for_screen camera shaking - 05/30/16 20:42

And for all beginners facing this problem,
Code:
c_ignore (...,0);

and
Code:
my.group

can help here ( besides PASSABLE and IGNORE_PASSABLE flags ).

Greets
Posted By: Reconnoiter

Re: vec_for_screen camera shaking - 05/31/16 09:34

I might as well give another tip now, you can use Define for 'groups' too to make your code cleaner and better readable, example:

Code:
//collision groups
#define ALLY_GROUP	1
#define ENEMY_GROUP	2
#define NATURE_GROUP	3
#define ITEM_GROUP	4

....
action squirrel() {
   my.group = NATURE_GROUP;
   ...
}

function convert_squirrels() {
   c_ignore(ALLY_GROUP, ITEM_GROUP, 0); //only enemies or nature
   if (c_trace(..., ..., ...) > 0) {
     if (you) you.group = ALLY_GROUP;
   }
}



Maybe a bit offtopic though grin
Posted By: rayp

Re: vec_for_screen camera shaking - 06/01/16 21:03

Quote:
Maybe a bit offtopic though grin
Thats totally ok in this case of usefull well written script example!
Posted By: Reconnoiter

Re: vec_for_screen camera shaking - 06/02/16 16:11

Originally Posted By: rayp
Quote:
Maybe a bit offtopic though grin
Thats totally ok in this case of usefull well written script example!
, tnx, I thought the addition of squirrels would really add something grin
© 2024 lite-C Forums