Jump to content

setCollisionVolumeDetectionCallback


photo

Recommended Posts

image.png.0e25fd878b1871babb3f8bfb06e4543e.png

image.png.8f0e5bb2811fc076e4ad08fae658bda9.png

bais form

use like this ?

//void(CollisionVolume * , ContactPtr, int contacted_entity, int contacted_segment)

 

what is mean first CollisionVolume and second ContactPtr?

 

first CollisionVolume is my Volume or contactVolume?

 

CollisionVolume's DetectedCallback is not work when contact with terrain?

 

 

Edited by dongju.jeong
Link to comment

Hi Dongju,

The first Unigine::Plugins::IG::Manager::setCollisionVolumeDetectionCallback() function receives a callback with the following signature:

 void(Unigine::Plugins::IG::ICollisionVolume *volume, Unigine::ShapeContactPtr contact, int contacted_entity, int contacted_volume)

 

The second Unigine::Plugins::IG::CollisionVolume::setCollisionDetectedCallback() function receives a callback with the same signature:

 void(Unigine::Plugins::IG::CollisionVolume * volume, Unigine::ShapeContactPtr contact, int contacted_entity, int contacted_volume)

 

where the parameters are:

  • volume - collision volume for which collisions are detected (your Volume)
  • contact - detected contact  (an instance of the ShapeContact class giving you information on coordinates of the point, contact duration, penetration depth, contact object, physical shapes participating in the contact, index of the contact surface)
  • contacted_entity - ID of the contacted entity
  • contacted_volume - ID of the contacted collision volume

The first method (Manager's) is used to process collisions detected for all existing collision volumes, while the second one (CollisionVolume's) to process only the collisions detected for a certain collision volume.

Quote

If the volume is set with the config file, does this function not work properly?

Your code should work ok.

We will update the documentation and comments with callback signature descriptions in the corresponding header files.

Thank you!

  • Like 1
Link to comment

CollisionVolume's DetectedCallback is not work when contact with terrain

 

and IG_Manager's setCollisionVolumeDetectionCallback is not called when Contact Entity that have CollisionVol and terrain.

 

I test with Hemu and version 2.9.

image.png.1379f69e6ae20f282fdadcbd08955379.png

 

How do I solve it?

How can I get contact with terrain?

Edited by dongju.jeong
Link to comment

You're using 2.9, right?

We've checked change history and non-entity collisions weren't implemented in this version. Since 2.10 you have ig_manager->setCollisionVolumeMask(~0); to specify additional collision masks.

In 2.9 you can workaround this manually handling these collisions to get a callback:

Vector<ContactPtr> contacts;
int res = shape->getCollision(contacts,0);
if (res ) 
for (auto & it : contacts)
{
//.. dosmth
}

Or upgrade to 2.11.

Thanks.

  • Like 2

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...