dimforge / dimforge/bevy_rapier

Recommended way to offset a collider?

Open
#370 4 comments 0 reactions 0 assignees View on GitHub
A-Dynamics C-Bug P-Medium S-not-started
Dominant language
Rust
Stars
1.6k
Forks
282
PR merge metrics
No merged PRs in 30d

Description

I have a body with the `KinematicCharacterController` component, I want to offset the collider on this body from the centre (since the sprite isn't centred). I tried the following but the character controller doesn't work without a collider attached directly to it:

```rust
commands
.spawn(RigidBody::KinematicPositionBased)
.insert(KinematicCharacterController::default())
.insert(SpriteSheetBundle {
sprite: TextureAtlasSprite {
index: 0,
..Default::default()
},
texture_atlas: atlas,
transform: Transform::from_xyz(0.0, 0.0, 1.0),
..Default::default()
})
.with_children(|children| {
children
.spawn(Collider::cuboid(6.5, 10.5))
.insert(TransformBundle::from_transform(Transform::from_xyz(
1.0, -8.0, 0.0,
)));
});
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.