Take collision groups into account for ray-casting.
This commit is contained in:
@@ -24,7 +24,8 @@ use rapier::dynamics::{
|
||||
#[cfg(feature = "dim3")]
|
||||
use rapier::geometry::Ray;
|
||||
use rapier::geometry::{
|
||||
BroadPhase, ColliderHandle, ColliderSet, ContactEvent, NarrowPhase, ProximityEvent,
|
||||
BroadPhase, ColliderHandle, ColliderSet, ContactEvent, InteractionGroups, NarrowPhase,
|
||||
ProximityEvent,
|
||||
};
|
||||
use rapier::math::Vector;
|
||||
use rapier::pipeline::{ChannelEventCollector, PhysicsPipeline, QueryPipeline};
|
||||
@@ -1188,10 +1189,12 @@ impl Testbed {
|
||||
.camera()
|
||||
.unproject(&self.cursor_pos, &na::convert(size));
|
||||
let ray = Ray::new(pos, dir);
|
||||
let hit = self
|
||||
.physics
|
||||
.query_pipeline
|
||||
.cast_ray(&self.physics.colliders, &ray, f32::MAX);
|
||||
let hit = self.physics.query_pipeline.cast_ray(
|
||||
&self.physics.colliders,
|
||||
&ray,
|
||||
f32::MAX,
|
||||
InteractionGroups::all(),
|
||||
);
|
||||
|
||||
if let Some((_, collider, _)) = hit {
|
||||
if self.physics.bodies[collider.parent()].is_dynamic() {
|
||||
|
||||
Reference in New Issue
Block a user