You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
I tried code above, but it doesn't work for me, what is wrong? In Contact_Test_1 I use BoxShape and test passed, but in Contact_Test_2 I use GImpactMeshShape and it doesn't work.
[TestFixture]publicclassContactTestCallbackTests{privatePhysicsContext_context;[OneTimeSetUp]publicvoidSetUp(){_context=new PhysicsContext();
_context.InitializeWorld();}private CollisionShape CreateGImpactShape(TriangleIndexVertexArrayshapeData){varshape=new GImpactMeshShape(shapeData){Margin=0};
shape.UpdateBound();returnshape;}private CollisionShape CreateTorusCollisionShape(){return CreateGImpactShape(new TriangleIndexVertexArray(Torus.Indices, Torus.Vertices));}[Test]publicvoidContact_Test_2(){varshape= CreateTorusCollisionShape();
GImpactCollisionAlgorithm.RegisterAlgorithm(_context.Dispatcher);varobj1= _context.AddStaticBody(shape, Matrix.Translation(0,0,0));varobj2= _context.AddStaticBody(shape, Matrix.Translation(0,0,0));using(varcallback=new SimpleCallback()){
_context.World.ContactPairTest(obj1, obj2, callback);
Assert.That(callback.WasCalled, Is.True);}}[Test]publicvoidContact_Test_1(){varshape=new BoxShape(2);varsphere1= _context.AddStaticBody(shape, Matrix.Translation(0,0,0));varsphere2= _context.AddStaticBody(shape, Matrix.Translation(0,0,0));using(varcallback=new SimpleCallback()){
_context.World.ContactPairTest(sphere1, sphere2, callback);
Assert.That(callback.WasCalled, Is.True);}}privatesealedclassSimpleCallback:ContactResultCallback{publicSimpleCallback(){}publicboolWasCalled{get;privateset;}// Called with each contact for your own processing (e.g. test if contacts fall in within sensor parameters)publicoverridedoubleAddSingleResult(ManifoldPointcontact,CollisionObjectWrappercolObj0,intpartId0,intindex0,CollisionObjectWrappercolObj1,intpartId1,intindex1){WasCalled=true;return0;}}[OneTimeTearDown]publicvoidTearDown(){
_context.Dispose();}}
The text was updated successfully, but these errors were encountered:
kvasnevskyivlad
changed the title
How to get collisions between to GImpactMesh?
How to get collisions between two GImpactMesh?
Jan 20, 2022
Hello!
I tried code above, but it doesn't work for me, what is wrong? In
Contact_Test_1
I useBoxShape
and test passed, but inContact_Test_2
I useGImpactMeshShape
and it doesn't work.The text was updated successfully, but these errors were encountered: