|
@@ -407,14 +407,18 @@ bool GodotBodyPair3D::pre_solve(real_t p_step) {
|
|
|
|
|
|
// contact query reporting...
|
|
|
|
|
|
- if (A->can_report_contacts()) {
|
|
|
+ if (A->can_report_contacts() || B->can_report_contacts()) {
|
|
|
+ Vector3 crB = B->get_angular_velocity().cross(c.rB) + B->get_linear_velocity();
|
|
|
Vector3 crA = A->get_angular_velocity().cross(c.rA) + A->get_linear_velocity();
|
|
|
- A->add_contact(global_A, -c.normal, depth, shape_A, global_B, shape_B, B->get_instance_id(), B->get_self(), crA, c.acc_impulse);
|
|
|
- }
|
|
|
+ Vector3 wlB = global_B - offset_B;
|
|
|
|
|
|
- if (B->can_report_contacts()) {
|
|
|
- Vector3 crB = B->get_angular_velocity().cross(c.rB) + B->get_linear_velocity();
|
|
|
- B->add_contact(global_B, c.normal, depth, shape_B, global_A, shape_A, A->get_instance_id(), A->get_self(), crB, -c.acc_impulse);
|
|
|
+ if (A->can_report_contacts()) {
|
|
|
+ A->add_contact(global_A, -c.normal, depth, shape_A, crA, wlB, shape_B, B->get_instance_id(), B->get_self(), crB, c.acc_impulse);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (B->can_report_contacts()) {
|
|
|
+ B->add_contact(wlB, c.normal, depth, shape_B, crB, global_A, shape_A, A->get_instance_id(), A->get_self(), crA, -c.acc_impulse);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (report_contacts_only) {
|
|
@@ -797,9 +801,9 @@ bool GodotBodySoftBodyPair3D::pre_solve(real_t p_step) {
|
|
|
|
|
|
if (body->can_report_contacts()) {
|
|
|
Vector3 crA = body->get_angular_velocity().cross(c.rA) + body->get_linear_velocity();
|
|
|
- body->add_contact(global_A, -c.normal, depth, body_shape, global_B, 0, soft_body->get_instance_id(), soft_body->get_self(), crA, c.acc_impulse);
|
|
|
+ Vector3 crB = soft_body->get_node_velocity(c.index_B);
|
|
|
+ body->add_contact(global_A, -c.normal, depth, body_shape, crA, global_B, 0, soft_body->get_instance_id(), soft_body->get_self(), crB, c.acc_impulse);
|
|
|
}
|
|
|
-
|
|
|
if (report_contacts_only) {
|
|
|
collided = false;
|
|
|
continue;
|