Collision events - explanation needed
Posted: Wed Mar 05, 2014 8:59 pm
Hi Norbo, I'd like to ask what's happening here.
I have two entities - "turret" with several other entities attached to it with weldjoin; and "hull" which is a compound, made of several shapes: "back", "front", "crew", "engine".
I'm firing a sphere ("projectile") at those and attach ContactsCreated event to it - in events body there's couple of logging methods fire up to record what's happening. I have such a scheme that when sphere hits entity for the first time, it records position, time and so on, and then it is allowed to go through, firing following contactscreated events, "inside" the entity.
First scenario - projectile hits the turret.
1) contact is created between "projectile" and one of the turret attachments, "zip-1" entity. Contact has one pair - I'm looking at other.Pairs parameter, with EntityA and EntityB set to "projectile" and "zip-1" entity, as expected.
2) next, projectile sphere goes through and another event is fired. Sphere is inside turret, we have two pairs (other.Pairs): first one is OK - EntityA and EntityB set as expected - "projectile" and "turret" accordingly. BUT, second pair has only EntityA set to "turret" and EntityB is null - QUESTION nr 1 - wtf? How is that?
3) sphere continues to travel inside "turret" and creates some more events, the same manner as described above: one "good" pair, and another with only EntityA set to the "turret" entity.
Then sphere ("projectile") travels outside "turret" entity hits terrain and is disposed - that's my code and it works as expected.
Second scenario - projectile hit the hull - compound entity.
1) contact is created between "projectile" and hull - Other parametr is set to "back", children shape of the compound - as expected, but Other.Pairs count is zero. Why so?
2) projectile travels through compound firing continues events hitting other children and for none of those Other.Pairs.Count returns more than 0.
Is this how compound works, when it comes to collisions?
Thanks,
S.
I have two entities - "turret" with several other entities attached to it with weldjoin; and "hull" which is a compound, made of several shapes: "back", "front", "crew", "engine".
I'm firing a sphere ("projectile") at those and attach ContactsCreated event to it - in events body there's couple of logging methods fire up to record what's happening. I have such a scheme that when sphere hits entity for the first time, it records position, time and so on, and then it is allowed to go through, firing following contactscreated events, "inside" the entity.
First scenario - projectile hits the turret.
1) contact is created between "projectile" and one of the turret attachments, "zip-1" entity. Contact has one pair - I'm looking at other.Pairs parameter, with EntityA and EntityB set to "projectile" and "zip-1" entity, as expected.
2) next, projectile sphere goes through and another event is fired. Sphere is inside turret, we have two pairs (other.Pairs): first one is OK - EntityA and EntityB set as expected - "projectile" and "turret" accordingly. BUT, second pair has only EntityA set to "turret" and EntityB is null - QUESTION nr 1 - wtf? How is that?
3) sphere continues to travel inside "turret" and creates some more events, the same manner as described above: one "good" pair, and another with only EntityA set to the "turret" entity.
Then sphere ("projectile") travels outside "turret" entity hits terrain and is disposed - that's my code and it works as expected.
Second scenario - projectile hit the hull - compound entity.
1) contact is created between "projectile" and hull - Other parametr is set to "back", children shape of the compound - as expected, but Other.Pairs count is zero. Why so?
2) projectile travels through compound firing continues events hitting other children and for none of those Other.Pairs.Count returns more than 0.
Is this how compound works, when it comes to collisions?
Thanks,
S.