Collider shape: use a trait-object instead of an enum.

This commit is contained in:
Crozet Sébastien
2020-10-20 11:55:33 +02:00
parent 947c4813c9
commit 865ce8a8e5
31 changed files with 782 additions and 438 deletions

View File

@@ -69,7 +69,11 @@ impl QueryPipeline {
for handle in inter {
let collider = &colliders[handle];
if let Some(inter) = collider.shape().cast_ray(collider.position(), ray, max_toi) {
if let Some(inter) =
collider
.shape()
.toi_and_normal_with_ray(collider.position(), ray, max_toi, true)
{
if inter.toi < best {
best = inter.toi;
result = Some((handle, collider, inter));
@@ -103,7 +107,11 @@ impl QueryPipeline {
for handle in inter {
let collider = &colliders[handle];
if let Some(inter) = collider.shape().cast_ray(collider.position(), ray, max_toi) {
if let Some(inter) =
collider
.shape()
.toi_and_normal_with_ray(collider.position(), ray, max_toi, true)
{
if !callback(handle, collider, inter) {
return;
}