[Feature Request] Ability to disable collision between two physics FBodyInstances
I would love to see a C++/blueprint function in Unreal Engine to disable all collision (blocking and overlaps) between two arbitrary FBodyInstances or PrimitiveComponents, similar to this Unity function:
This would be a very useful addition to the existing collision channel filtering system and make the physics in Unreal Engine extremely customizable. It appears that only skeletal mesh components support this kind of filtering at the moment via FPhysScene::CollisionDisableTableLookup.
I am aware of PrimitiveComponent's MoveIgnoreActors, however this does not appear to affect blocking collisions, only overlaps.
asked Jun 05 '15 at 06:20 AM in C++ Programming
I've looked it over and it seems like this would be a useful feature when presented with the limit that collision channels have when it comes to numbers. I've played a feature request into our system for the function. For your reference the number is UE-16728. While I can't guarantee that the request will be fulfilled, I will be sure to update you here with any updates to its status.
Have a nice day,
answered Jun 09 '15 at 02:01 PM
Matthew J ♦♦ STAFF
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.
answered Jun 06 '15 at 03:22 AM
I like the idea but I believe this could be easily achieved with collision channels. If you make a custom collision channel for your character and set them up to be a channel that gets blocked by normal things, but ignores others of it's own type, you could accomplish this with relative ease.
These two pages should be of some help if you wish to go down this path: https://docs.unrealengine.com/latest/INT/Engine/Physics/Collision/index.html https://www.unrealengine.com/blog/collision-filtering
Hope this helps!
answered Jun 05 '15 at 03:00 PM
Matthew J ♦♦ STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here