How can I make two same entity not hit each other?

Posted By: uone

How can I make two same entity not hit each other? - 07/07/09 04:12

How can I make two same entity not hit each other?
I have my code below but they two created new balls still collide to each other. some advice please...


function bounce_off()

{
if (you) // collided with another entity?
{
if( (you._ball!=10) && (me._ball!=10))
{

set(my,ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_DETECT);
effect(particle_ball,maxv(1,40*time_step),my.x,vector(0,0,5));
vec_to_angle(my.pan, bounce);
my.pan += 5 - random(10);
my.tilt = 0;
my.roll = 0;
my.z = 0;

}else if( (me._ball==10) && (you._ball==10))
{

set(you,IGNORE_YOU);
set(me,IGNORE_ME);


}
}

}
Posted By: Germanunkol

Re: How can I make two same entity not hit each other? - 07/07/09 08:42

set their flag2 and then IGNORE_FLAG2 in the c_move.

You can also create collision groups: instead of this:

set(you,IGNORE_YOU);
set(me,IGNORE_ME);

put:

return(0);

and then in the c_move use ACTIVATE_PUSH as a mode.
Posted By: uone

Re: How can I make two same entity not hit each other? - 07/07/09 09:48

thanks man.... your the best!
what a quick solution it works now.
Posted By: Germanunkol

Re: How can I make two same entity not hit each other? - 07/09/09 08:47

No problem.
If you ever figure out why there's an IGNORE_FLAG2, but no IGNORE_FLAG3, tell me :P
Posted By: VeT

Re: How can I make two same entity not hit each other? - 07/09/09 08:49

xD
Posted By: uone

Re: How can I make two same entity not hit each other? - 07/09/09 09:31

no, can you explain to me?
Posted By: Germanunkol

Re: How can I make two same entity not hit each other? - 07/09/09 09:35

Sorry, I have no idea why that is. But using ACTIVATE_PUSH works for defining large numbers of collision groups, so it's fine. Just IGNORE_FLAG2 would be much faster (in code, and I think in calculation at runtime, too.)
I was just wondering why they never added it...
© 2023 lite-C Forums