Skip to content

Add the f64 XPBD demos to the README #225

Add the f64 XPBD demos to the README

Add the f64 XPBD demos to the README #225

GitHub Actions / clippy succeeded Mar 19, 2024 in 3s

clippy

122 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 122
Note 0
Help 0

Versions

  • rustc 1.76.0 (07dca489a 2024-02-04)
  • cargo 1.76.0 (c84b36747 2024-01-18)
  • clippy 0.1.76 (07dca48 2024-02-04)

Annotations

Check warning on line 63 in demos/src/moving_platform.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

associated function `make_system` is never used

warning: associated function `make_system` is never used
  --> demos/src/moving_platform.rs:63:8
   |
54 | impl MovingPlatform {
   | ------------------- associated function in this implementation
...
63 |     fn make_system<V: Component>(
   |        ^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

Check warning on line 214 in demos/src/ui/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `setting_from_ui`

warning: unused variable: `setting_from_ui`
   --> demos/src/ui/mod.rs:214:5
    |
214 |     setting_from_ui: Res<DemoUiPhysicsBackendActive>,
    |     ^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_setting_from_ui`

Check warning on line 7 in demos/src/moving_platform.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `app`

warning: unused variable: `app`
 --> demos/src/moving_platform.rs:7:21
  |
7 |     fn build(&self, app: &mut App) {
  |                     ^^^ help: if this is intentional, prefix it with an underscore: `_app`
  |
  = note: `#[warn(unused_variables)]` on by default

Check warning on line 291 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

returning the result of a `let` binding from a block

warning: returning the result of a `let` binding from a block
   --> demos/src/bin/platformer_3d.rs:291:9
    |
174 | /         let command_altering_selectors = CommandAlteringSelectors::default()
175 | |             // By default Tnua uses a raycast, but this could be a problem if the character stands
176 | |             // just past the edge while part of its body is above the platform. To solve this, we
177 | |             // need to cast a shape - which is physics-engine specific. We set the shape using a
...   |
271 | |                 },
272 | |             );
    | |______________- unnecessary `let` binding
...
291 |           command_altering_selectors
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
    = note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
    |
174 ~         
175 |         #[cfg(feature = "rapier3d")]
  ...
192 |         );
193 ~         CommandAlteringSelectors::default()
194 +             // By default Tnua uses a raycast, but this could be a problem if the character stands
195 +             // just past the edge while part of its body is above the platform. To solve this, we
196 +             // need to cast a shape - which is physics-engine specific. We set the shape using a
197 +             // component.
198 +             .with_combo(
199 +                 "Sensor Shape",
200 +                 1,
201 +                 &[
202 +                     ("no", |mut cmd| {
203 +                         #[cfg(feature = "rapier3d")]
204 +                         cmd.remove::<TnuaRapier3dSensorShape>();
205 +                         #[cfg(feature = "xpbd3d")]
206 +                         cmd.remove::<TnuaXpbd3dSensorShape>();
207 +                     }),
208 +                     ("flat (underfit)", |mut cmd| {
209 +                         #[cfg(feature = "rapier3d")]
210 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
211 +                             0.0, 0.49,
212 +                         )));
213 +                         #[cfg(feature = "xpbd3d")]
214 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.49)));
215 +                     }),
216 +                     ("flat (exact)", |mut cmd| {
217 +                         #[cfg(feature = "rapier3d")]
218 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
219 +                             0.0, 0.5,
220 +                         )));
221 +                         #[cfg(feature = "xpbd3d")]
222 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.5)));
223 +                     }),
224 +                     ("flat (overfit)", |mut cmd| {
225 +                         #[cfg(feature = "rapier3d")]
226 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
227 +                             0.0, 0.51,
228 +                         )));
229 +                         #[cfg(feature = "xpbd3d")]
230 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.51)));
231 +                     }),
232 +                     ("ball (underfit)", |mut cmd| {
233 +                         #[cfg(feature = "rapier3d")]
234 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::ball(0.49)));
235 +                         #[cfg(feature = "xpbd3d")]
236 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::sphere(0.49)));
237 +                     }),
238 +                     ("ball (exact)", |mut cmd| {
239 +                         #[cfg(feature = "rapier3d")]
240 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::ball(0.5)));
241 +                         #[cfg(feature = "xpbd3d")]
242 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::sphere(0.5)));
243 +                     }),
244 +                 ],
245 +             )
246 +             .with_checkbox("Lock Tilt", true, |mut cmd, lock_tilt| {
247 +                 // Tnua will automatically apply angular impulses/forces to fix the tilt and make
248 +                 // the character stand upward, but it is also possible to just let the physics
249 +                 // engine prevent rotation (other than around the Y axis, for turning)
250 +                 if lock_tilt {
251 +                     #[cfg(feature = "rapier3d")]
252 +                     cmd.insert(
253 +                         rapier::LockedAxes::ROTATION_LOCKED_X
254 +                             | rapier::LockedAxes::ROTATION_LOCKED_Z,
255 +                     );
256 +                     #[cfg(feature = "xpbd3d")]
257 +                     cmd.insert(xpbd::LockedAxes::new().lock_rotation_x().lock_rotation_z());
258 +                 } else {
259 +                     #[cfg(feature = "rapier3d")]
260 +                     cmd.insert(rapier::LockedAxes::empty());
261 +                     #[cfg(feature = "xpbd3d")]
262 +                     cmd.insert(xpbd::LockedAxes::new());
263 +                 }
264 +             })
265 +             .with_checkbox(
266 +                 "Phase Through Collision Groups",
267 +                 true,
268 +                 |mut cmd, use_collision_groups| {
269 +                     #[cfg(feature = "rapier3d")]
270 +                     if use_collision_groups {
271 +                         cmd.insert(CollisionGroups {
272 +                             memberships: Group::GROUP_2,
273 +                             filters: Group::GROUP_2,
274 +                         });
275 +                     } else {
276 +                         cmd.insert(CollisionGroups {
277 +                             memberships: Group::ALL,
278 +                             filters: Group::ALL,
279 +                         });
280 +                     }
281 +                     #[cfg(feature = "xpbd3d")]
282 +                     {
283 +                         let player_layers: LayerMask = if use_collision_groups {
284 +                             [LayerNames::Player].into()
285 +                         } else {
286 +                             [LayerNames::Player, LayerNames::PhaseThrough].into()
287 +                         };
288 +                         cmd.insert(CollisionLayers::new(player_layers, player_layers));
289 +                     }
290 +                 },
291 +             )
    |

Check warning on line 291 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

returning the result of a `let` binding from a block

warning: returning the result of a `let` binding from a block
   --> demos/src/bin/platformer_3d.rs:291:9
    |
174 | /         let command_altering_selectors = CommandAlteringSelectors::default()
175 | |             // By default Tnua uses a raycast, but this could be a problem if the character stands
176 | |             // just past the edge while part of its body is above the platform. To solve this, we
177 | |             // need to cast a shape - which is physics-engine specific. We set the shape using a
...   |
271 | |                 },
272 | |             );
    | |______________- unnecessary `let` binding
...
291 |           command_altering_selectors
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
    = note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
    |
174 ~         
175 |         #[cfg(feature = "rapier3d")]
  ...
192 |         );
193 ~         CommandAlteringSelectors::default()
194 +             // By default Tnua uses a raycast, but this could be a problem if the character stands
195 +             // just past the edge while part of its body is above the platform. To solve this, we
196 +             // need to cast a shape - which is physics-engine specific. We set the shape using a
197 +             // component.
198 +             .with_combo(
199 +                 "Sensor Shape",
200 +                 1,
201 +                 &[
202 +                     ("no", |mut cmd| {
203 +                         #[cfg(feature = "rapier3d")]
204 +                         cmd.remove::<TnuaRapier3dSensorShape>();
205 +                         #[cfg(feature = "xpbd3d")]
206 +                         cmd.remove::<TnuaXpbd3dSensorShape>();
207 +                     }),
208 +                     ("flat (underfit)", |mut cmd| {
209 +                         #[cfg(feature = "rapier3d")]
210 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
211 +                             0.0, 0.49,
212 +                         )));
213 +                         #[cfg(feature = "xpbd3d")]
214 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.49)));
215 +                     }),
216 +                     ("flat (exact)", |mut cmd| {
217 +                         #[cfg(feature = "rapier3d")]
218 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
219 +                             0.0, 0.5,
220 +                         )));
221 +                         #[cfg(feature = "xpbd3d")]
222 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.5)));
223 +                     }),
224 +                     ("flat (overfit)", |mut cmd| {
225 +                         #[cfg(feature = "rapier3d")]
226 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
227 +                             0.0, 0.51,
228 +                         )));
229 +                         #[cfg(feature = "xpbd3d")]
230 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.51)));
231 +                     }),
232 +                     ("ball (underfit)", |mut cmd| {
233 +                         #[cfg(feature = "rapier3d")]
234 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::ball(0.49)));
235 +                         #[cfg(feature = "xpbd3d")]
236 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::sphere(0.49)));
237 +                     }),
238 +                     ("ball (exact)", |mut cmd| {
239 +                         #[cfg(feature = "rapier3d")]
240 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::ball(0.5)));
241 +                         #[cfg(feature = "xpbd3d")]
242 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::sphere(0.5)));
243 +                     }),
244 +                 ],
245 +             )
246 +             .with_checkbox("Lock Tilt", true, |mut cmd, lock_tilt| {
247 +                 // Tnua will automatically apply angular impulses/forces to fix the tilt and make
248 +                 // the character stand upward, but it is also possible to just let the physics
249 +                 // engine prevent rotation (other than around the Y axis, for turning)
250 +                 if lock_tilt {
251 +                     #[cfg(feature = "rapier3d")]
252 +                     cmd.insert(
253 +                         rapier::LockedAxes::ROTATION_LOCKED_X
254 +                             | rapier::LockedAxes::ROTATION_LOCKED_Z,
255 +                     );
256 +                     #[cfg(feature = "xpbd3d")]
257 +                     cmd.insert(xpbd::LockedAxes::new().lock_rotation_x().lock_rotation_z());
258 +                 } else {
259 +                     #[cfg(feature = "rapier3d")]
260 +                     cmd.insert(rapier::LockedAxes::empty());
261 +                     #[cfg(feature = "xpbd3d")]
262 +                     cmd.insert(xpbd::LockedAxes::new());
263 +                 }
264 +             })
265 +             .with_checkbox(
266 +                 "Phase Through Collision Groups",
267 +                 true,
268 +                 |mut cmd, use_collision_groups| {
269 +                     #[cfg(feature = "rapier3d")]
270 +                     if use_collision_groups {
271 +                         cmd.insert(CollisionGroups {
272 +                             memberships: Group::GROUP_2,
273 +                             filters: Group::GROUP_2,
274 +                         });
275 +                     } else {
276 +                         cmd.insert(CollisionGroups {
277 +                             memberships: Group::ALL,
278 +                             filters: Group::ALL,
279 +                         });
280 +                     }
281 +                     #[cfg(feature = "xpbd3d")]
282 +                     {
283 +                         let player_layers: LayerMask = if use_collision_groups {
284 +                             [LayerNames::Player].into()
285 +                         } else {
286 +                             [LayerNames::Player, LayerNames::PhaseThrough].into()
287 +                         };
288 +                         cmd.insert(CollisionLayers::new(player_layers, player_layers));
289 +                     }
290 +                 },
291 +             )
    |

Check warning on line 249 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:249:18
    |
249 |                 |mut cmd, use_collision_groups| {
    |                  ----^^^
    |                  |
    |                  help: remove this `mut`

Check warning on line 249 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:249:18
    |
249 |                 |mut cmd, use_collision_groups| {
    |                  ----^^^
    |                  |
    |                  help: remove this `mut`

Check warning on line 227 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:227:48
    |
227 |             .with_checkbox("Lock Tilt", true, |mut cmd, lock_tilt| {
    |                                                ----^^^
    |                                                |
    |                                                help: remove this `mut`

Check warning on line 227 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:227:48
    |
227 |             .with_checkbox("Lock Tilt", true, |mut cmd, lock_tilt| {
    |                                                ----^^^
    |                                                |
    |                                                help: remove this `mut`

Check warning on line 219 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:219:39
    |
219 |                     ("ball (exact)", |mut cmd| {
    |                                       ----^^^
    |                                       |
    |                                       help: remove this `mut`

Check warning on line 213 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:213:42
    |
213 |                     ("ball (underfit)", |mut cmd| {
    |                                          ----^^^
    |                                          |
    |                                          help: remove this `mut`

Check warning on line 219 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:219:39
    |
219 |                     ("ball (exact)", |mut cmd| {
    |                                       ----^^^
    |                                       |
    |                                       help: remove this `mut`

Check warning on line 205 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:205:41
    |
205 |                     ("flat (overfit)", |mut cmd| {
    |                                         ----^^^
    |                                         |
    |                                         help: remove this `mut`

Check warning on line 213 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:213:42
    |
213 |                     ("ball (underfit)", |mut cmd| {
    |                                          ----^^^
    |                                          |
    |                                          help: remove this `mut`

Check warning on line 205 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:205:41
    |
205 |                     ("flat (overfit)", |mut cmd| {
    |                                         ----^^^
    |                                         |
    |                                         help: remove this `mut`

Check warning on line 197 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:197:39
    |
197 |                     ("flat (exact)", |mut cmd| {
    |                                       ----^^^
    |                                       |
    |                                       help: remove this `mut`

Check warning on line 197 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:197:39
    |
197 |                     ("flat (exact)", |mut cmd| {
    |                                       ----^^^
    |                                       |
    |                                       help: remove this `mut`

Check warning on line 189 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:189:42
    |
189 |                     ("flat (underfit)", |mut cmd| {
    |                                          ----^^^
    |                                          |
    |                                          help: remove this `mut`

Check warning on line 183 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:183:29
    |
183 |                     ("no", |mut cmd| {
    |                             ----^^^
    |                             |
    |                             help: remove this `mut`
    |
    = note: `#[warn(unused_mut)]` on by default

Check warning on line 189 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:189:42
    |
189 |                     ("flat (underfit)", |mut cmd| {
    |                                          ----^^^
    |                                          |
    |                                          help: remove this `mut`

Check warning on line 183 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:183:29
    |
183 |                     ("no", |mut cmd| {
    |                             ----^^^
    |                             |
    |                             help: remove this `mut`
    |
    = note: `#[warn(unused_mut)]` on by default

Check warning on line 295 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cmd`

warning: unused variable: `cmd`
   --> demos/src/bin/platformer_3d.rs:295:59
    |
295 |     cmd.insert(TnuaCrouchEnforcer::new(0.5 * Vector3::Y, |cmd| {
    |                                                           ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`

Check warning on line 249 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `use_collision_groups`

warning: unused variable: `use_collision_groups`
   --> demos/src/bin/platformer_3d.rs:249:27
    |
249 |                 |mut cmd, use_collision_groups| {
    |                           ^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_use_collision_groups`

Check warning on line 249 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cmd`

warning: unused variable: `cmd`
   --> demos/src/bin/platformer_3d.rs:249:22
    |
249 |                 |mut cmd, use_collision_groups| {
    |                      ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`

Check warning on line 295 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cmd`

warning: unused variable: `cmd`
   --> demos/src/bin/platformer_3d.rs:295:59
    |
295 |     cmd.insert(TnuaCrouchEnforcer::new(0.5 * Vector3::Y, |cmd| {
    |                                                           ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`