min/max_xyz pseudo-collision

Posted By: deianthropus

min/max_xyz pseudo-collision - 07/24/10 17:33

I'm trying to detect when the player passes through a passable entity, using min_ and max_, and a convoluted series of if statements. I need help sorting out the &'s and |'s to make this work as simply as possible. (I would use a collision event, but the object must be passable, as the player is a physics entity and must continue without bouncing, as in collecting coins).

What I essentially want to do is detect whether any of the points of the bounding box of the first object is within the space of the second, but as short-hand as possible, using min_x/y/z and max_x/y/z. Does anyone have any suggestions as to how to organize that? I have been using <= and => to compare the points, but should I just use c_trace?
Posted By: deianthropus

Re: min/max_xyz pseudo-collision - 07/25/10 16:49

Update: I am now using C-trace to check for objects with skill30 (which I am using as an object type reference for WED models) along the vector from the center of the player's model (a rolling sphere) to the corners of its bounding box. This is simpler than the code i had imagined. Basically, I'm using

Code:
if(c_trace(player.x,vector(player.min_x,player.min_y,player.min_z),IGNORE_WORLD|IGNORE_FLAG2){collision_event();}



for each of the combinations of min, max, x, y, and z.

This works fairly well, however there are issues - objects well past the end of the tracing vector are detected when they are directly under the player. And perhaps I should use a wait() function to only detect passable objects every other frame, to save proc time.
© 2024 lite-C Forums