I was working on some basic player movement and ran into problems with finding the contact normals.
As far as I can tell, the only way of retrieving the normal is by reading b2Manifold's contactPlaneNormal. Based on the type of the manifold I can also differ whether this normal is relative to FixtureA's or FixtureB's vertices / edge. I was under the impression, that the given normal would also be directed out the relevant fixture's hull. For instance when having something collide with the top of a planar platform and provided the normal was given relative to the platform's fixture, it would point perfectly upwards.
When implementing jumping and some basic conditions on when to enable it, I encountered this scenario:
These are some traces that I print when jumping and touching.
The "Update" is called every 100ms and checks for ongoing contacts using b2Body::GetContactList(); the first two values describe the contact normal, trailed by the involved fixtures and the manifold type (-> 2 would imply e_faceA, and therefore [Player] is the relevant fixture in all cases listed here, unless I am mistaken). BEGIN and END are traces from the BeginContact and EndContact callbacks in my ContactListener.

Q1: Why does GetContactList() still return the contact, when according to the ContactListener, it's ended already?
Q2: Similarly, why are these "phantom" contacts in the contactlist, when they shouldn't be there yet (see BEGIN)?
Also, perhaps more importantly, the contact normal is directed downward, when it should be relative to the player ("[Player]" and "2").
Q3: How is it, that some the correct normals are found when "forcefully" touching the platform?
I'm working with 2.1alpha by the way, so this might be related to some restructuring.
Thanks a lot in advance, I'd really appreciate some input on this issue!
As far as I can tell, the only way of retrieving the normal is by reading b2Manifold's contactPlaneNormal. Based on the type of the manifold I can also differ whether this normal is relative to FixtureA's or FixtureB's vertices / edge. I was under the impression, that the given normal would also be directed out the relevant fixture's hull. For instance when having something collide with the top of a planar platform and provided the normal was given relative to the platform's fixture, it would point perfectly upwards.
When implementing jumping and some basic conditions on when to enable it, I encountered this scenario:
These are some traces that I print when jumping and touching.
The "Update" is called every 100ms and checks for ongoing contacts using b2Body::GetContactList(); the first two values describe the contact normal, trailed by the involved fixtures and the manifold type (-> 2 would imply e_faceA, and therefore [Player] is the relevant fixture in all cases listed here, unless I am mistaken). BEGIN and END are traces from the BeginContact and EndContact callbacks in my ContactListener.
Code:
// standing on Platform I
Update 0 1 [Player] [Platform I] 2
Update 0 1 [Player] [Platform I] 2
// player jumping high
END
Update 0 1 [Player] [Platform I] 2 // ad Q1
Update 0 1 [Player] [Platform II] 2 // ad Q2
Update 0 1 [Player] [Platform II] 2 // ad Q2
Update 0 1 [Player] [Platform II] 2 // ad Q2
// usually, this would be the end of it, the player would just fall down again
// but by manually triggering another jump (since the jumping condition is now wrongly fulfilled - a contact normal of (0,1) relative to the player gives the impression of standing on planar ground) an extra push towards Platform II's bottom is given and - lo and behold - ...
BEGIN
// touching the upper platform (Platform II)
END
// some actually correct normals are given (the player basically hitting his head)
Update 0 -1 [Player] [Platform II] 2
Update 0 -1 [Player] [Platform II] 2
Update 0 -1 [Player] [Platform II] 2
Update 0 1 [Player] [Platform I] 2
Update 0 1 [Player] [Platform I] 2
// player jumping high
END
Update 0 1 [Player] [Platform I] 2 // ad Q1
Update 0 1 [Player] [Platform II] 2 // ad Q2
Update 0 1 [Player] [Platform II] 2 // ad Q2
Update 0 1 [Player] [Platform II] 2 // ad Q2
// usually, this would be the end of it, the player would just fall down again
// but by manually triggering another jump (since the jumping condition is now wrongly fulfilled - a contact normal of (0,1) relative to the player gives the impression of standing on planar ground) an extra push towards Platform II's bottom is given and - lo and behold - ...
BEGIN
// touching the upper platform (Platform II)
END
// some actually correct normals are given (the player basically hitting his head)
Update 0 -1 [Player] [Platform II] 2
Update 0 -1 [Player] [Platform II] 2
Update 0 -1 [Player] [Platform II] 2

Q1: Why does GetContactList() still return the contact, when according to the ContactListener, it's ended already?
Q2: Similarly, why are these "phantom" contacts in the contactlist, when they shouldn't be there yet (see BEGIN)?
Also, perhaps more importantly, the contact normal is directed downward, when it should be relative to the player ("[Player]" and "2").
Q3: How is it, that some the correct normals are found when "forcefully" touching the platform?
I'm working with 2.1alpha by the way, so this might be related to some restructuring.
Thanks a lot in advance, I'd really appreciate some input on this issue!