Skip to content

Commit

Permalink
Fix outdated references to ColliderBundle and RigidBodyBundle
Browse files Browse the repository at this point in the history
  • Loading branch information
sebcrozet committed Jan 1, 2023
1 parent fd45995 commit 7307c90
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 21 deletions.
16 changes: 5 additions & 11 deletions docs/user_guides/templates/advanced_collision_detection.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,12 @@ Sometimes, [collision groups and solver groups](colliders#collision-groups-and-s
to achieve the desired behavior. In that case, the contact filtering hooks let you apply custom rules to filter contact
pairs and intersection pairs:
- For each potential contact pair (between two non-sensor colliders) detected by the broad-phase, if at least one
of the colliders involved in the pair has the bit `ActiveHooks::FILTER_CONTACT_PAIRS` enabled in its
of the colliders involved in the pair has the bit `ActiveHooks::FILTER_CONTACT_PAIR` enabled in its
[active hooks](colliders#active-hooks), then `PhysicsHooks::filter_contact_pair` will be called. If this filter
returns `None` then no contact computation will happen for this pair of colliders. If it returns `Some` then the
narrow-phase will compute contact points.
- For each potential intersection pair (between a sensor colliders and another collider) detected by the broad-phase, if
at least one of the colliders involved in the pair has the bit `ActiveHooks::FILTER_INTERSECTION_PAIRS` enabled
at least one of the colliders involved in the pair has the bit `ActiveHooks::FILTER_INTERSECTION_PAIR` enabled
in its [active hooks](colliders#active-hooks), then `PhysicsHooks::filter_intersection_pair` will be called. If this
filter returns `false` then no intersection computation will happen for this pair of colliders. If it returns `true`
then the narrow-phase will test whether or not they are intersecting.
Expand Down Expand Up @@ -505,15 +505,9 @@ fn setup_physics(mut commands: Commands) {
// Add colliders with a `CustomFilterTag` component. Only colliders
// with the same `CustomFilterTag` variant will collider thanks to
// our custom physics hooks:
let collider = ColliderBundle {
material: ColliderMaterial {
active_hooks: ActiveHooks::FILTER_CONTACT_PAIRS
| ActiveHooks::FILTER_INTERSECTION_PAIRS,
..Default::default()
}.into(),
..Default::default()
};
commands.spawn_bundle(collider)
commands.spawn(Collider::Ball(0.5))
.insert(ActiveHooks::FILTER_CONTACT_PAIR
| ActiveHooks::FILTER_INTERSECTION_PAIR)
.insert(CustomFilterTag::GroupA);

// TODO: add other colliders in a similar way.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pairs and intersection pairs:
returns `null` then no contact computation will happen for this pair of colliders. If it returns a `SolverFlags` value then the
narrow-phase will compute contact points.
- For each potential intersection pair (between a sensor colliders and another collider) detected by the broad-phase, if
at least one of the colliders involved in the pair has the bit `ActiveHooks.FILTER_INTERSECTION_PAIRS` enabled
at least one of the colliders involved in the pair has the bit `ActiveHooks.FILTER_INTERSECTION_PAIR` enabled
in its [active hooks](colliders#active-hooks), then `PhysicsHooks.filterIntersectionPair` will be called. If this
filter returns `false` then no intersection computation will happen for this pair of colliders. If it returns `true`
then the narrow-phase will test whether or not they are intersecting.
Expand Down
5 changes: 0 additions & 5 deletions docs/user_guides/templates/collider_active_events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ assert!(collider.active_events().contains(ActiveEvents::COLLISION_EVENTS));

```rust
/* Set the active events when the collider is created. */
let collider = ColliderBundle {
flags: (ActiveEvents::COLLISION_EVENTS).into(),
..Default::default()
};
commands.spawn_bundle(collider);
commands.spawn(Collider::ball(0.5))
.insert(ActiveEvents::COLLISION_EVENTS);
```
Expand Down
4 changes: 2 additions & 2 deletions docs/user_guides/templates/collider_active_hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import TabItem from '@theme/TabItem';
pairs, or modify contacts, based on arbitrary user code. In order to enable a physics hook for a pair of colliders, at
least one of the involved colliders must have the corresponding hook set as active. A hook is activated for a collider
by setting its corresponding active hooks bit to `1`:
- Setting the <notjs>`ActiveHooks::FILTER_CONTACT_PAIRS`</notjs><js>`ActiveHooks.FILTER_CONTACT_PAIRS`</js> bit to 1
- Setting the <notjs>`ActiveHooks::FILTER_CONTACT_PAIR`</notjs><js>`ActiveHooks.FILTER_CONTACT_PAIR`</js> bit to 1
enables the manual [filtering of all the contact pairs](advanced_collision_detection#contact-and-intersection-filtering)
involving the collider.
- Setting the <notjs>`ActiveHooks::FILTER_INTERSECTION_PAIRS`</notjs><js>`ActiveHooks.FILTER_INTERSECTION_PAIRS`</js>bit
- Setting the <notjs>`ActiveHooks::FILTER_INTERSECTION_PAIR`</notjs><js>`ActiveHooks.FILTER_INTERSECTION_PAIR`</js>bit
to 1 enables the manual [filtering of all the contact pairs](advanced_collision_detection#contact-and-intersection-filtering)
involving the collider.
<notjs>- Setting the `ActiveHooks::MODIFY_SOLVER_CONTACTS` bit to 1
Expand Down
2 changes: 0 additions & 2 deletions docs/user_guides/templates/collider_mass_properties.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ values={[
<TabItem value="2D">

```rust
let rigid_body = RigidBodyBundle::default();
// First option: by setting the density of the collider (or we could just leave
// its default value 1.0).
let collider_mprops = ColliderMassProperties::Density(2.0);
Expand All @@ -112,7 +111,6 @@ commands.spawn(RigidBody::Dynamic)
<TabItem value="3D">

```rust
let rigid_body = RigidBodyBundle::default();
// First option: by setting the density of the collider (or we could just leave
// its default value 1.0).
let collider_mprops = ColliderMassProperties::Density(2.0);
Expand Down

0 comments on commit 7307c90

Please sign in to comment.