Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collider example from documentation not working as expected #245

Closed
dafteran4 opened this issue Nov 14, 2023 · 2 comments · Fixed by #330
Closed

Collider example from documentation not working as expected #245

dafteran4 opened this issue Nov 14, 2023 · 2 comments · Fixed by #330
Labels
C-Bug Something isn't working C-Docs Improvements or additions to documentation

Comments

@dafteran4
Copy link

This is from Collider docs. But the 'Transform' component has no effect, the ball is not spawned at desired height. If replaced with 'Position' component, it works as expected.

// Spawn a dynamic body that falls onto a static platform
fn setup(mut commands: Commands) {
    commands.spawn((
        RigidBody::Dynamic,
        Collider::ball(0.5),
        Transform::from_xyz(0.0, 2.0, 0.0),
    ));
    commands.spawn((RigidBody::Static, Collider::cuboid(5.0, 0.5, 5.0)));
}
@Jondolf Jondolf added the C-Bug Something isn't working label Nov 14, 2023
@dafteran4
Copy link
Author

By changing to TransformBundle::from(Transform...) everything works as expected.

@Jondolf
Copy link
Owner

Jondolf commented Nov 14, 2023

Ah, yeah you need GlobalTransform for it to be positioned correctly. The docs should be updated to fix that example though

@Jondolf Jondolf added the C-Docs Improvements or additions to documentation label Nov 14, 2023
Jondolf added a commit that referenced this issue Feb 18, 2024
# Objective

Fixes #245.

The docs have a few errors and outdated method names.

## Solution

- Use `TransformBundle` instead of `Transform` in `Collider` docs to make positioning actually work
- Fix `cast_ray_predicate` docs calling the wrong method and using non-existent variables
- Fix `compute_aabb` -> `aabb`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug Something isn't working C-Docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants