Isometry fields are NaN for TriMesh rigid bodies
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 120
- PR merge metrics
- No merged PRs in 30d
Description
Here is an example that reproduces the issue, based on the `trimesh3` example:
```rust
fn main() {
let mut world = World::new();
let quad = ncollide3d::procedural::quad(10.0, 10.0, 10, 10);
let indices = quad
.flat_indices()
.chunks(3)
.map(|is| Point3::new(is[0] as usize, is[2] as usize, is[1] as usize))
.collect();
let vertices = quad.coords;
let geom = ShapeHandle::new(TriMesh::new(vertices, indices, None));
// Add first object
let pos = Isometry3::new(Vector3::new(1.0, 2.0, 3.0), na::zero());
let handle = world.add_rigid_body(pos, Inertia3::zero(), na::Point3::new(4.0, 5.0, 6.0));
let col_handle1 = world.add_collider(
COLLIDER_MARGIN,
geom.clone(),
handle,
Isometry3::identity(),
Material::default(),
);
// Add second object
let pos = Isometry3::new(Vector3::new(1.0, 2.0, 3.0), na::zero());
let handle = world.add_rigid_body(pos, Inertia3::zero(), na::Point3::new(4.0, 5.0, 6.0));
let col_handle2 = world.add_collider(
COLLIDER_MARGIN,
geom.clone(),
handle,
Isometry3::identity(),
Material::default(),
);
world.step();
world.step();
println!("{:?}", world.collider(col_handle1).unwrap().position());
println!("{:?}", world.collider(col_handle2).unwrap().position());
}
```
Output:
```
Isometry { rotation: Unit { value: Quaternion { coords: Matrix { data: [NaN, NaN, NaN, NaN] } } }, translation: Translation { vector: Matrix { data: [NaN, NaN, NaN] } }, _noconstruct: PhantomData }
Isometry { rotation: Unit { value: Quaternion { coords: Matrix { data: [NaN, NaN, NaN, NaN] } } }, translation: Translation { vector: Matrix { data: [NaN, NaN, NaN] } }, _noconstruct: PhantomData }
```
Two static rigid bodies are created using a `TriMesh` as their colliders. After calling `world.step()` twice, the translation and rotation of both the rigid body and the collider of each rigid body are filled with NaN. I would expect even static bodies such as `TriMesh`s to have a position and rotation, and this is indeed the case if `world.step()` is only called once in the above example.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.