// Copyright 2025 International Digital Economy Academy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///|
pub struct CollisionPipeline {
priv marker : Unit
}
///|
pub fn CollisionPipeline::CollisionPipeline() -> CollisionPipeline {
let value = { marker: () }
value.marker |> ignore
value
}
///|
pub fn CollisionPipeline::step(
self : CollisionPipeline,
prediction_distance : @core.Real,
islands : @dynamics.IslandManager,
broad_phase : @collision.BroadPhaseBvh,
narrow_phase : @collision.NarrowPhase,
bodies : @dynamics.RigidBodySet,
colliders : @collision.ColliderSet,
impulse_joints : @dynamics.ImpulseJointSet,
multibody_joints : @dynamics.MultibodyJointSet,
physics_hooks : PhysicsHooks,
event_handler : EventHandler,
) -> Unit {
self |> ignore
islands |> ignore
event_handler |> ignore
let modified_colliders = colliders.take_modified()
let removed_colliders = colliders.take_removed()
let invalidated_colliders : Array[@collision.ColliderHandle] = []
for i in 0.. 0 {
narrow_phase.handle_user_changes(bodies, colliders, invalidated_colliders)
}
broad_phase.update(prediction_distance, bodies, colliders)
let pairs = broad_phase.pairs()
let filtered_pairs = []
fn is_dynamic_collider(
bodies : @dynamics.RigidBodySet,
collider : @collision.Collider,
) -> Bool {
if collider.parent() is Some(parent) {
if bodies.get(parent) is Some(body) {
body.body_type() is Dynamic
} else {
false
}
} else {
false
}
}
for i in 0..