Hi ,
Thanks for the quick reply! I’m not talking about characters though - I’m talking about arbitrarily disabling/enabling collision between any two FBodyInstance pairs anywhere in the physics scene at any time. This would be a very powerful bit of functionality, and is something the UE4 collision filtering system can’t approximate right now, especially with the 32 collision channel limit. I believe this is the reason Unity added their Physics.IgnoreCollision function.
Please understand that adding this functionality wouldn’t replace the collision filtering system as it stands, it would just be an advanced-use function to give extra fine grained control. I’m sure you can appreciate that UE4 devs are starting to use the engine for things other than FPSes and there are going to be unforeseen situations that can’t be addressed with collision filtering alone, particularly with MMOs (lots of actors of the same type) and complex actors made up of multiple primitive components that require unusual physics behaviour/interactions.
Let me throw out a couple of examples that will hopefully change your mind.
Imagine a physics-based train simulator game. A train actor is made up of a bunch of box carriages packed tightly together in a row (static mesh components simulating physics), and let’s assume I’m not using the skeletal mesh component or physics joints for this, I’d like to do all the train movement myself in blueprint.
Now, lets say when a train turns a tight corner that the carriages inter-penetrate a little bit at the corners. For art reasons I can’t change the geometry or carriage distances to prevent this. I can easily use the collision filtering system (as you suggested) to prevent carriages from blocking each other but still allow them block the world and other physics props in the scene.
But now imagine I’ve placed two trains in the world. Now none of the carriages will collide with each other, even if TrainA and TrainB overlap! Okay, so let’s make two collision channels, one for TrainA carriages, one for TrainB carriages, and they’ll block each other, but not themselves. That works, but now I want to add 50 more trains to the scene. See the problem?
This is the reason UE4’s SkeletalMeshComponent and PhysicsConstraints have added the ability to disable specific collision pairs internally. It would be great to have it as a more general engine feature that we can use and abuse from C++ or blueprint.
Another example would be a cannonball game for 32+ players. Let’s say there’s only two types of actors existing on a big flat plane: cannons, and cannonballs. Cannonballs are fired out of the cannons at other players’ cannons. Unlike the ShooterGame example, we don’t want to use overlaps for the cannonball projectile collision detection, we want them to use blocking collisions instead so when a cannonball hits someone else’s cannon, it will bounce off it using physics (and deal damage on the hit event). When a cannonball is fired, we want it to spawn well inside the cannon geo/collision and shoot outwards so it looks good visually. So we need each cannonball to ignore collision with its owner cannon only, but collide with all other cannons. We could simply disable cannonball collision entirely for the first X seconds of its life, but that’s a bit hacky - what if there’s an enemy cannon right in front of it? Maybe we could set it to use overlapping collision until it’s no longer overlapping with its owner cannon any more, then change it to use blocking collision after that, but that’s a lot of work compared to just being able to turn off specific collision with its owner cannon.
Hopefully these examples have demonstrated the usefulness of a C++/blueprint function to arbitrarily disable collision between two FBodyInstances in the scene. UE4 already sort-of supports it internally via skeletal mesh components and physics constraints, I’d just love for it to be available elsewhere to make the lives of gameplay programmers a bit easier.
Thanks!