Skip to content

Commit a4bb9e9

Browse files
committed
fixed heightfield collider not working (fix for rapier3d regression)
- heightfield collider must be moved manually at the center of the heightfield
1 parent 092ebbd commit a4bb9e9

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

fyrox-impl/src/scene/graph/physics.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -730,8 +730,6 @@ fn make_heightfield(terrain: &Terrain) -> Option<SharedShape> {
730730
}
731731
let x_scale = terrain.chunk_size().x * scale.x * col_range as f32;
732732
let z_scale = terrain.chunk_size().y * scale.z * row_range as f32;
733-
let x_pos = terrain.chunk_size().x * scale.x * chunk_min.x as f32;
734-
let z_pos = terrain.chunk_size().y * scale.z * chunk_min.y as f32;
735733
let mut hf = HeightField::new(
736734
Array2::new(nrows as usize, ncols as usize, data),
737735
Vec3::new(x_scale, 1.0, z_scale),
@@ -765,10 +763,7 @@ fn make_heightfield(terrain: &Terrain) -> Option<SharedShape> {
765763
}
766764
// HeightField colliders naturally have their origin at their centers,
767765
// so to position the collider correctly we must add half of the size to x and z.
768-
Some(SharedShape::compound(vec![(
769-
Pose3::translation(x_scale * 0.5 + x_pos, 0.0, z_scale * 0.5 + z_pos),
770-
SharedShape::new(hf),
771-
)]))
766+
Some(SharedShape::new(hf))
772767
}
773768

774769
// Converts descriptor in a shared shape.

0 commit comments

Comments
 (0)