I have already answered this on the GitHub issues page, but for completeness:

Place all these collision models in the same collision family (see 
ChCollisionModel::SetFamily<https://api.projectchrono.org/classchrono_1_1_ch_collision_model.html#ab591335fd235fb5590e7204f4b7ad5bf>)
 and then disable collision between models in that family (see 
ChCollisionModel::DissallowCollisionsWith<https://api.projectchrono.org/classchrono_1_1_ch_collision_model.html#a93ece48505bc18dce4fb53645f61b2bb>).

--Radu

From: [email protected] <[email protected]> On Behalf 
Of Francesco Gatti
Sent: Sunday, September 8, 2024 5:35 PM
To: ProjectChrono <[email protected]>
Subject: [chrono] Collision detection performance drop if objects collides with 
heightmap terrain

Hi,
I noticed a strange perforce drop if objects intersects with heightmap terrain.
Lets take the demo_SEN_Gator example and do the following steps:
1. change  terrain model to HEIGHMAP:
```
RigidTerrain::PatchType terrain_model = RigidTerrain::PatchType::HEIGHT_MAP
```
2. add some obstacles in the sky
```
    // obstacles
    for (int i = 0; i < 100; i++) {
        float x = (((float)rand() / RAND_MAX) - 0.5f) * 100.f;
        float y = (((float)rand() / RAND_MAX) - 0.5f) * 100.f;
        auto box_body = chrono_types::make_shared<ChBodyEasyBox>(4, 4, 4, 1000, 
true, true, patch_mat);
        box_body->SetPos({x, y, 6});
        box_body->SetFixed(true);
        
box_body->GetVisualShape(0)->SetTexture(GetChronoDataFile("textures/bluewhite.png"));
        box_body->GetVisualShape(0)->SetMutable(false);
        gator.GetSystem()->Add(box_body);
    }
```
3. run demo: the performance is not affected
4. move the obstacles near the ground
```
    // obstacles
    for (int i = 0; i < 100; i++) {
        float x = (((float)rand() / RAND_MAX) - 0.5f) * 100.f;
        float y = (((float)rand() / RAND_MAX) - 0.5f) * 100.f;
        auto box_body = chrono_types::make_shared<ChBodyEasyBox>(4, 4, 4, 1000, 
true, true, patch_mat);
        box_body->SetPos({x, y, 0});
        box_body->SetFixed(true);
        
box_body->GetVisualShape(0)->SetTexture(GetChronoDataFile("textures/bluewhite.png"));
        box_body->GetVisualShape(0)->SetMutable(false);
        gator.GetSystem()->Add(box_body);
    }
```
5. run demo: huge performance drop

with BOX terrain this does not happen. The processing time increases a lot in 
ComputeCollisions() function.
Is this behavior a limit of the collision detection module or i am making 
something wrong?

Thanks,
Francesco

--
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/75c41ab9-ac41-4ccb-b92c-1c08ee3344ccn%40googlegroups.com<https://urldefense.com/v3/__https:/groups.google.com/d/msgid/projectchrono/75c41ab9-ac41-4ccb-b92c-1c08ee3344ccn*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Mak6IKo!K07g7arJq9aMBnw_d63SGKgykhRxcmD8CzrWkZdu-huzrstyes6hwNv_xDAAR4IACrHGE32xKOzKdW2J28DPPg8h5A$>.

-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/CH3PPF46CDC2185490AFC7165BA37BC1EABA7982%40CH3PPF46CDC2185.namprd06.prod.outlook.com.

Reply via email to