private void drawContact (Contact contact) { WorldManifold worldManifold = contact.getWorldManifold(); if (worldManifold.getNumberOfContactPoints() == 0) return; Vector2 point = worldManifold.getPoints()[0]; renderer.point(point.x, point.y, 0); }
private void drawContact (Contact contact) { WorldManifold worldManifold = contact.getWorldManifold(); if (worldManifold.getNumberOfContactPoints() == 0) return; Vector2 point = worldManifold.getPoints()[0]; renderer.setColor(getColorByBody(contact.getFixtureA().getBody())); renderer.point(point.x, point.y, 0); }
private boolean isPlayerGrounded (float deltaTime) { groundedPlatform = null; Array<Contact> contactList = world.getContactList(); for (int i = 0; i < contactList.size; i++) { Contact contact = contactList.get(i); if (contact.isTouching() && (contact.getFixtureA() == playerSensorFixture || contact.getFixtureB() == playerSensorFixture)) { Vector2 pos = player.getPosition(); WorldManifold manifold = contact.getWorldManifold(); boolean below = true; for (int j = 0; j < manifold.getNumberOfContactPoints(); j++) { below &= (manifold.getPoints()[j].y < pos.y - 1.5f); } if (below) { if (contact.getFixtureA().getUserData() != null && contact.getFixtureA().getUserData().equals("p")) { groundedPlatform = (Platform)contact.getFixtureA().getBody().getUserData(); } if (contact.getFixtureB().getUserData() != null && contact.getFixtureB().getUserData().equals("p")) { groundedPlatform = (Platform)contact.getFixtureB().getBody().getUserData(); } return true; } return false; } } return false; }
WorldManifold manifold = contact.getWorldManifold(); int numContactPoints = manifold.getNumberOfContactPoints(); for (int j = 0; j < numContactPoints; j++) {
private void drawContact (Contact contact) { WorldManifold worldManifold = contact.getWorldManifold(); if (worldManifold.getNumberOfContactPoints() == 0) return; Vector2 point = worldManifold.getPoints()[0]; renderer.setColor(getColorByBody(contact.getFixtureA().getBody())); renderer.point(point.x, point.y, 0); }
float ml = car.getCarModel().length; float half_ml = ml * 0.5f; Vector2[] pts = contact.getWorldManifold().getPoints(); int num_points = contact.getWorldManifold().getNumberOfContactPoints(); for (int i = 0; i < num_points; i++) { Vector2 lp = fcar.getBody().getLocalPoint(pts[i]);