Always generate a BVH in flex.
The BVH is used also for computing normalized vertex coordinates in the trilinear interpolation, so we need to compute it also when the flex cannot collide. PiperOrigin-RevId: 756349244 Change-Id: Ib397c472e31251df5a7ea85850d83a62f3b2c949
This commit is contained in:
committed by
Copybara-Service
parent
f4774a5449
commit
ad80a4625b
@@ -3624,8 +3624,9 @@ void mjCFlex::CreateBVH() {
|
||||
elemaabb_[6*e+5] = 0.5*(xmax[2]-xmin[2]) + radius;
|
||||
|
||||
// add bounding volume for this element
|
||||
// contype and conaffinity are set to nonzero to force bvh generation
|
||||
const double* aabb = elemaabb_.data() + 6*e;
|
||||
tree.AddBoundingVolume(e, contype, conaffinity, aabb, nullptr, aabb);
|
||||
tree.AddBoundingVolume(e, 1, 1, aabb, nullptr, aabb);
|
||||
nbvh++;
|
||||
}
|
||||
|
||||
|
||||
@@ -243,6 +243,27 @@ TEST_F(UserFlexTest, RigidFlex) {
|
||||
mj_deleteModel(m);
|
||||
mj_deleteData(d);
|
||||
}
|
||||
|
||||
TEST_F(UserFlexTest, FlexNotCollide) {
|
||||
static constexpr char xml[] = R"(
|
||||
<mujoco>
|
||||
<worldbody>
|
||||
<flexcomp name="test" pos="1 0 -1" type="grid"
|
||||
count="5 5 5" spacing="1 1 1" dim="3">
|
||||
<contact contype="0" conaffinity="0"/>
|
||||
</flexcomp>
|
||||
</worldbody>
|
||||
</mujoco>
|
||||
)";
|
||||
std::array<char, 1024> error;
|
||||
mjModel* m = LoadModelFromString(xml, error.data(), error.size());
|
||||
ASSERT_THAT(m, NotNull()) << error.data();
|
||||
mjData* d = mj_makeData(m);
|
||||
mj_step(m, d);
|
||||
mj_deleteModel(m);
|
||||
mj_deleteData(d);
|
||||
}
|
||||
|
||||
TEST_F(UserFlexTest, BoundingBoxCoordinates) {
|
||||
static constexpr char xml[] = R"(
|
||||
<mujoco>
|
||||
|
||||
Reference in New Issue
Block a user