public override void PreSolve(b2Contact contact, b2Manifold oldManifold) { b2Manifold manifold = contact.GetManifold(); if (manifold.pointCount == 0) { return; } b2Fixture fixtureA = contact.GetFixtureA(); b2Fixture fixtureB = contact.GetFixtureB(); b2Collision.b2GetPointStates(state1, state2, oldManifold, manifold); contact.GetWorldManifold(ref worldManifold); for (int i = 0; i < manifold.pointCount && m_pointCount < k_maxContactPoints; ++i) { ContactPoint cp = m_points[m_pointCount]; if (cp == null) { cp = new ContactPoint(); m_points[m_pointCount] = cp; } cp.fixtureA = fixtureA; cp.fixtureB = fixtureB; cp.position = worldManifold.points[i]; cp.normal = worldManifold.normal; cp.state = state2[i]; ++m_pointCount; } }
private void CalculateDetails() { _DetailsCalculated = true; _ContactPoints = new TypeVector2 <Vector2>(); b2WorldManifold worldManifold = new b2WorldManifold(); _Contact.GetWorldManifold(worldManifold); _Normal = worldManifold.normal.ToVector2(); _ContactPoints.x = Box2d.b2Vec2Array_getitem(worldManifold.points, 0).ToVector2(); _ContactPoints.y = Box2d.b2Vec2Array_getitem(worldManifold.points, 1).ToVector2(); }