Sign in to follow this  

[physx3.3.0] doing a chain of interlocked capsules

This topic is 816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello there, new to gamedev forum. I am a C++ newbie and PhysX virgin. I hope I won't waste people time...

 

That being said. I managed to do a script to generate a scene with a loop to generate a series of neatly aligned capsules. 

 

I would like to do something similar to this (https://www.youtube.com/watch?v=oyjE5L4-1lQ).

 

Capsules are being used for that. The n+1 capsule does not collide with the n capsule if n+1 because the collision filter is set to ignore objects collisions if objects are joined.

 

I would like to reproduce this kind of collision filtering in PhysX, to tell physx not to detect collisions between objects that are joined together.

 

I tried looking into official Physx documentation, but there is nothing about this specific case. 

 

Has anybody tried this could it be done at all?

Share this post


Link to post
Share on other sites
//create custom filter
PxFilterFlags customFilterShader(PxFilterObjectAttributes attributes0, PxFilterData filterData0, 
										PxFilterObjectAttributes attributes1, PxFilterData filterData1,
										PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize)
{
	// all initial and persisting reports for everything, with per-point data
	pairFlags = PxPairFlag::eCONTACT_DEFAULT | PxPairFlag::eTRIGGER_DEFAULT | PxPairFlag::eNOTIFY_CONTACT_POINTS | PxPairFlag::eCCD_LINEAR; //Set flag to enable CCD (Continuous Collision Detection) 
	
	return PxFilterFlag::eDEFAULT;
	//more ugly test code
    if(PxFilterObjectIsTrigger(attributes0) || PxFilterObjectIsTrigger(attributes1)) // <---- this is where you define the custom attribute if I understand...
    {
            pairFlags = PxPairFlag::eTRIGGER_DEFAULT;
            return PxFilterFlag::eDEFAULT;
    }
	//end more ugly test code
}
//end of custom filter

Here is a textbook example from a very helpful book I bought (Learning Physics Modeling with PhysX) but I have a hard time finding example for the case I developped in the OP (attribute that indicate two objects are joined... )

 

So I am stuck looking for the right thing to put between the "ugly test code" comment lines.

Share this post


Link to post
Share on other sites


 
Capsules are being used for that. The n+1 capsule does not collide with the n capsule if n+1 because the collision filter is set to ignore objects collisions if objects are joined.
 
I would like to reproduce this kind of collision filtering in PhysX, to tell physx not to detect collisions between objects that are joined together.
 

 

This question is a bit confusing. But if I understand correctly, you are trying to make a system where your features are joined together, but the capsules do not collide with whats behind them.

 

I am not familiar with Phyx, but Bullet was designed not just for use in gaming, but also for use in digital media. So there's quite a bit of freedom with it.

There are a few methods I'd suggest trying

The first one is to find a way to filter by perobject. Using too many filters could potentially clutter your bitflags which can be used for more useful things. If you can filter by a perobject basis, you can make a daisy chain algorithm using a linked list or an array to achieve this effect.

 

The second one is to use the regular chaining schema that -should- be included in Nvidia's Physx.

Share this post


Link to post
Share on other sites

Sorry, I missed the answer because I was offline waiting for some Ikea furniture (that never arrived...).

 

 

 

The second one is to use the regular chaining schema that -should- be included in Nvidia's Physx.

If there is a page or a link to the feature I would be interested and grateful (google returns nothing useful with chains+physx).

 

Custom filter could work, but the main problem is to find a practical simple working example of the filter attributes...

 

If I can't tell physx to ignore collisions between adjacent joined bodies, the chain is going to explode on launch or be extremely jittery. 

 

This code gives me an idea of how I should do it... 

// let triggers through
if(PxFilterObjectIsTrigger(attributes0) || PxFilterObjectIsTrigger(attributes1))
{
        pairFlags = PxPairFlag::eTRIGGER_DEFAULT;
        return PxFilterFlag::eDEFAULT;
}

This page makes me think I should use the eSOLVE_CONTACT which is used in the default contact resolution according to pxfiltering.h. 

 

Still digging.

Share this post


Link to post
Share on other sites

Ok. Reporting on my progress so far, I found this link that finally gave me the filter flag I was looking for... eKILL.

 

No I just have to find how to tell the filter to do that only for object that are joined together by joints (non contact joints) 

Share this post


Link to post
Share on other sites

Success...

 

In the end the filter shader seems ridiculous simple (I was looking for something much more complicated...).

If it helps anyone trying to do the same thing....

PxFilterFlags customFilterShader(PxFilterObjectAttributes attributes0, PxFilterData filterData0, 
										PxFilterObjectAttributes attributes1, PxFilterData filterData1,
										PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize)

{
		pairFlags = PxPairFlag::eCONTACT_DEFAULT;
		return PxFilterFlag::eDEFAULT;
}

qnqz50.png

Share this post


Link to post
Share on other sites

This topic is 816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this