Skip to content
This repository has been archived by the owner on Jun 29, 2024. It is now read-only.

Commit

Permalink
upd fetch depth
Browse files Browse the repository at this point in the history
  • Loading branch information
Ughuuu committed Nov 6, 2023
1 parent 335446b commit 67ae443
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/android_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Set up Java 11
uses: actions/setup-java@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ios_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Build ${{ matrix.arch }}
uses: ./.github/actions/build
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- name: Build ${{ matrix.arch }}
uses: ./.github/actions/build
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/macos_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- name: Build ${{ matrix.arch }}
uses: ./.github/actions/build
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/web_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- name: Set up Emscripten latest
uses: mymindstorm/setup-emsdk@v12
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Setup MSVC problem matcher
uses: ammaraskar/msvc-problem-matcher@master

Expand Down
1 change: 0 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import os
import sys

env = SConscript("godot-cpp/SConstruct")

box2d_folder = "box2d/"
box2d_include = [
"include/",
Expand Down
2 changes: 0 additions & 2 deletions src/box2d-wrapper/box2d_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,6 @@ size_t world_get_active_objects_count(b2World *world_handle);

void world_set_active_body_callback(b2World *world_handle, ActiveBodyCallback callback);

void world_set_collision_event_callback(b2World *world_handle, CollisionEventCallback callback);

void world_set_collision_filter_callback(b2World *world_handle,
b2ContactFilter *callback);

Expand Down
24 changes: 17 additions & 7 deletions src/spaces/box2d_space_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ bool Box2DSpace2D::ShouldCollide(b2Fixture *fixtureA, b2Fixture *fixtureB) {
}
box2d::CollisionEventInfo event_info_from_contact(b2Contact *contact) {
box2d::CollisionEventInfo event_info;
event_info.is_sensor = false;
event_info.is_valid = false;
event_info.collider1 = contact->GetFixtureA();
event_info.collider2 = contact->GetFixtureB();
Expand All @@ -131,7 +132,7 @@ box2d::CollisionEventInfo event_info_from_contact(b2Contact *contact) {
ERR_FAIL_COND_V(!box2d::is_user_data_valid(event_info.user_data1), event_info);
ERR_FAIL_COND_V(!box2d::is_user_data_valid(event_info.user_data2), event_info);
event_info.is_sensor = event_info.collider1->IsSensor() || event_info.collider2->IsSensor();
event_info.is_valid = true;
event_info.is_valid = event_info.is_sensor;
return event_info;
}
box2d::CollisionFilterInfo filter_info_from_contact(b2Contact *contact) {
Expand Down Expand Up @@ -162,20 +163,26 @@ box2d::ContactForceEventInfo force_info_from_contact(b2Contact *contact) {
}
void Box2DSpace2D::BeginContact(b2Contact *contact) {
box2d::CollisionEventInfo event_info = event_info_from_contact(contact);
ERR_FAIL_COND(!event_info.is_valid);
if (!event_info.is_valid) {
return;
}
event_info.is_started = true;
collision_event_callback(handle, &event_info);
}

void Box2DSpace2D::EndContact(b2Contact *contact) {
box2d::CollisionEventInfo event_info = event_info_from_contact(contact);
ERR_FAIL_COND(!event_info.is_valid);
if (!event_info.is_valid) {
return;
}
event_info.is_started = false;
collision_event_callback(handle, &event_info);
}
void Box2DSpace2D::PreSolve(b2Contact *contact, const b2Manifold *oldManifold) {
box2d::CollisionFilterInfo filter_info = filter_info_from_contact(contact);
ERR_FAIL_COND(!filter_info.is_valid);
if (!filter_info.is_valid) {
return;
}
box2d::OneWayDirection one_way_dir = collision_modify_contacts_callback(handle, &filter_info);
Transform2D transform_a = box2d::collider_get_transform(handle, contact->GetFixtureA());
Transform2D transform_b = box2d::collider_get_transform(handle, contact->GetFixtureA());
Expand Down Expand Up @@ -211,7 +218,9 @@ void Box2DSpace2D::PreSolve(b2Contact *contact, const b2Manifold *oldManifold) {
}
void Box2DSpace2D::PostSolve(b2Contact *contact, const b2ContactImpulse *impulse) {
box2d::ContactForceEventInfo force_info = force_info_from_contact(contact);
ERR_FAIL_COND(!force_info.is_valid);
if (!force_info.is_valid) {
return;
}
bool send_contacts = contact_force_event_callback(handle, &force_info);
if (send_contacts) {
box2d::ContactPointInfo point_info;
Expand All @@ -225,8 +234,8 @@ void Box2DSpace2D::PostSolve(b2Contact *contact, const b2ContactImpulse *impulse
point_info.impulse_2 = impulse->normalImpulses[1];
point_info.tangent_impulse_1 = impulse->tangentImpulses[0];
point_info.tangent_impulse_2 = impulse->tangentImpulses[1];
point_info.local_pos_1 = contact->GetManifold()->points[0].localPoint;
point_info.local_pos_2 = contact->GetManifold()->points[1].localPoint;
point_info.local_pos_1 = worldManifold.points[0];
point_info.local_pos_2 = worldManifold.points[1];
point_info.velocity_pos_1 = contact->GetFixtureA()->GetBody()->GetLinearVelocityFromLocalPoint(point_info.local_pos_1);
point_info.velocity_pos_2 = contact->GetFixtureB()->GetBody()->GetLinearVelocityFromLocalPoint(point_info.local_pos_2);
contact_point_callback(handle, &point_info, &force_info);
Expand Down Expand Up @@ -759,6 +768,7 @@ Box2DSpace2D::Box2DSpace2D() {

box2d::world_set_active_body_callback(handle, active_body_callback);
box2d::world_set_collision_filter_callback(handle, this);
box2d::world_set_contact_listener(handle, this);
}

Box2DSpace2D::~Box2DSpace2D() {
Expand Down

0 comments on commit 67ae443

Please sign in to comment.