bonding box

Posted By: BastovBros

bonding box - 11/29/09 16:46

A question about the bounding box. My player has the bounding box, so he is non-passable when he is not in the vehicle. The vehicle also has the bounding box, so when I get in the vehicle it behaives unpredictably, thus I make the player passable, when he enters the vehicle
if(my.x == vehicle.x){ set(my,PASSABLE);}
though when I get out of the vehicle again, I cannot make myself unpassable again? Is there a flag opposite to PASSABE?
Another question: if I for example make the player unpassable all the time, even if I enter the vehicle, I don't care about its weird behavior, though when I get out from it, the player's bounding box is changed, it is much bigger now....why so? I try to adjust his bounding box again, c_setminmax(me), then vec_set(my.min_x.....) and so on, but the bounding box does not change to its normal scale. Even if I put the c_setminmax in the loop, the bounding box changes to the normal scale, but it attempts to change to that bigger scale every frame... So the player looks as if he is jumping slightly all the time.... How to fix it? Any ideas?
Thanks in advance
Posted By: muffel

Re: bonding box - 11/29/09 17:06

Why you can't get unpassabble?
Are you using reset(me,PASSABLE) to make the player unpassable, or how do you do it?
muffel
Posted By: Webster_

Re: bonding box - 11/29/09 17:07

reset(me,PASSABLE);
Posted By: EvilSOB

Re: bonding box - 11/29/09 17:14

Are your SURE you are using "reset(me,PASSABLE);" when the
ME pointer is set to the player (rather than the car)?

Easy mistake to make. Done it many times myself...
Posted By: BastovBros

Re: bonding box - 11/29/09 18:03

Never mind about the passable problem, I figured it out already, rather tell me please waht might be wrong with the bounding box? Why does it change its scale?
Posted By: MMike

Re: bonding box - 11/29/09 18:31

ohh you forgot this i guess..
When you set the new values for the bounding box, as you stated above, you have to call update_hull(entity) i guess thats the name of the function.. other wise the bounding box wont get to its normal size so to say.
Posted By: BastovBros

Re: bonding box - 11/29/09 18:55

Emmm... better to say I didn't know about this laugh Anyways thanks, I'll try....
Posted By: MMike

Re: bonding box - 11/29/09 19:10

Yeah sometimes it happens to me too...

dot forget to feedback.
Posted By: BastovBros

Re: bonding box - 11/29/09 20:19

I am "feedbacking": well, I think you mean c_updatehull , thogh , I don't think I need it, it takes a lot of fps and it is basically for changing the bounding box if the animation changes, e. g. if the player ducks ,then lies, then stands. So it will change the bounding box each frame as the player is running, which I don't need. I tried to write some new values for the bounding box and put the c_setminmax in the loop, and it now works fine... I think it was the engine bug or something... I hope it won't happen again, unless I understand why yhis happens.
Posted By: MMike

Re: bonding box - 11/29/09 21:32

but if you change the c_setminmax i guess it requires the c_update too? no? each time you change the hull you must update the hull to fit that values, at least thats what i thought
Posted By: BastovBros

Re: bonding box - 11/29/09 21:34

Manual says that the c_setminmax is enough laugh I don't know exactly, ask the better programmer, I am not that good. Anyways it works now with c_setminmax in a loop.
Posted By: Widi

Re: bonding box - 11/29/09 21:41

You have a wait(1) before c_setminmax? (From the manual).
Posted By: BastovBros

Re: bonding box - 11/30/09 11:40

well, since I have it in the loop, I don't need wait(1) now.....
Posted By: BastovBros

Re: bonding box - 11/30/09 13:45

btw, another issue about the bounding box: I am using the c_trace to simulate the gravity, but I don't know why the player walk with his feet a bit under the ground, and sometimes the player walks on different distance from the terrain surface. I tried to chnage the boundin box's z value, so that it begins a bit under the model, though it didn't help much, the player walks well on certain areas but under the ground with his feet on other areas. The question is: how to simulate the gravity, so that the player walks perfectly on the terrain surface. I just played the "Territory" demo, the player walks perfectly on the surface there, I wanted to write this question in that thread but it would be off-topic in the projects section. So, can anyone help?
Btw, here is the part of the code I use in the player's action, it also simulates the fall with acceleration.
Code:
var a = 1;
action player(){
	while(1){
c_setminmax(me);
vec_set(my.min_x,vector(0,-1.2,-0.7));
vec_set(my.max_x,vector(2.7,1.2,13));
   	trace_to_ground = c_trace(my.x, vector(my.x,my.y,my.z-5000),IGNORE_ME|IGNORE_PASSENTS|IGNORE_PASSABLE|IGNORE_SPRITES|USE_BOX);
   	if(trace_to_ground > 1){
   		a +=0.2;
   		if(my.z > target.z){my.z -= a*time_step;
}
if(my.z < target.z){my.z = target.z;
}
wait(1);}


Posted By: muffel

Re: bonding box - 11/30/09 14:09

I would use c_move for the falling part
so the feets aren't under the surface if your Bounding Box is right

muffel
Posted By: BastovBros

Re: bonding box - 11/30/09 14:45

OK, I'll try this, but how about simply walking on a surface?
© 2024 lite-C Forums