dimforge / dimforge/bevy_rapier
RevoluteJoint ignores Transform
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 282
- PR merge metrics
- No merged PRs in 30d
Description
Rapier cylinders are spawned with the flat side facing up. I need to rotate them about the x axis to make them stand up in order to function as a wheel. I am able to do this without the Rapier by providing a `Transform` to the `PbrBundle`. However when I try to attach the cylinder to a `RevoluteJoint`, this rotation is lost. I saw an [example](https://github.com/gavlig/gryazevichki/blob/gryazevichki_rapier_v0.12.0-alpha.0/src/main.rs#L368) where you could provide a `position` to a `ColliderBundle`, but that appears to be a deprecated API. How I am I supposed to rotate the `Collider`?
```rust
let mut spawn_wheel = move |x, z| {
let wheel_y = constants::WHEEL_THICKNESS;
let joint = RevoluteJointBuilder::new(Vec3::Z)
.local_anchor1(Vec3::new(x, -constants::TRUCK_HEIGHT / 3., 2. * z))
.local_anchor2(Vec3::new(0., wheel_y, 0.));
let transform = Transform {
translation: Vec3::new(x, -constants::TRUCK_HEIGHT / 3., 2. * z),
rotation: -Quat::from_rotation_x(PI / 2.),
..default()
};
child_builder.spawn((
PbrBundle {
mesh: mesh.clone(),
material: material.clone(),
transform,
..default()
},
RigidBody::Dynamic,
Collider::cylinder(
constants::WHEEL_THICKNESS / 2.,
constants::WHEEL_DIAMETER / 2.,
),
ImpulseJoint::new(child_builder.parent_entity(), joint),
));
};
```
## Expected (joint/physics disabled):

## Actual (joints enabled):

Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.