fix contact debug-rendering for compound shapes

This commit is contained in:
Sébastien Crozet
2024-04-07 22:17:59 +02:00
committed by Sébastien Crozet
parent 7cbbb8e87b
commit a44f39a7b6

View File

@@ -9,6 +9,7 @@ use crate::math::{Isometry, Point, Real, Vector, DIM};
use crate::pipeline::debug_render_pipeline::debug_render_backend::DebugRenderObject; use crate::pipeline::debug_render_pipeline::debug_render_backend::DebugRenderObject;
use crate::pipeline::debug_render_pipeline::DebugRenderStyle; use crate::pipeline::debug_render_pipeline::DebugRenderStyle;
use crate::utils::SimdBasis; use crate::utils::SimdBasis;
use parry::utils::IsometryOpt;
use std::any::TypeId; use std::any::TypeId;
use std::collections::HashMap; use std::collections::HashMap;
@@ -115,16 +116,19 @@ impl DebugRenderPipeline {
if backend.filter_object(object) { if backend.filter_object(object) {
for manifold in &pair.manifolds { for manifold in &pair.manifolds {
for contact in manifold.contacts() { for contact in manifold.contacts() {
let world_subshape_pos1 =
manifold.subshape_pos1.prepend_to(co1.position());
backend.draw_line( backend.draw_line(
object, object,
co1.position() * contact.local_p1, world_subshape_pos1 * contact.local_p1,
co2.position() * contact.local_p2, manifold.subshape_pos2.prepend_to(co2.position())
* contact.local_p2,
self.style.contact_depth_color, self.style.contact_depth_color,
); );
backend.draw_line( backend.draw_line(
object, object,
co1.position() * contact.local_p1, world_subshape_pos1 * contact.local_p1,
co1.position() world_subshape_pos1
* (contact.local_p1 * (contact.local_p1
+ manifold.local_n1 * self.style.contact_normal_length), + manifold.local_n1 * self.style.contact_normal_length),
self.style.contact_normal_color, self.style.contact_normal_color,