|
How can I make two same entity not hit each other?
#276916
07/07/09 04:12
07/07/09 04:12
|
Joined: Jun 2009
Posts: 17 Cebu Philippines
uone
OP
Newbie
|
OP
Newbie
Joined: Jun 2009
Posts: 17
Cebu Philippines
|
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);
} } }
|
|
|
Re: How can I make two same entity not hit each other?
[Re: uone]
#276952
07/07/09 08:42
07/07/09 08:42
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
Expert
|
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
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.
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: How can I make two same entity not hit each other?
[Re: uone]
#277420
07/09/09 08:47
07/09/09 08:47
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
Expert
|
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
No problem. If you ever figure out why there's an IGNORE_FLAG2, but no IGNORE_FLAG3, tell me :P
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: How can I make two same entity not hit each other?
[Re: uone]
#277439
07/09/09 09:35
07/09/09 09:35
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
Expert
|
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
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...
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
|