Initially I thought it would cause a object its used on to pass through all static objects. But this is not in fact what happens. I added it to a vehicle, but it did not pass through any staticobjects.
This collision group is completely unused by anything. Since I was aware that other collision groups are part of objects by default like with projectiles, I realized that this one isn't assigned to any object and by default no object is using this collision group, which explains why adding it to a object will not allow it to pass through static objects. Because all those said objects are not added to this collision group. The command must be specified and that collision group must be assigned to it and any other objects you want them to "not" interact with.
This means that some interesting things can be done with this since nothing is using it, no ill effects will occur from using it in a mod.
The best use I've come up with is selective projectile penetration. The trick is to add a projectile to the c_CGStaticObjects collision group. Then any other object that is using this collision group, it will not collide with. Thus passing through it as if it's not there.
This is NOT the same as the effect achieved via adding a static object like a fence to the c_CGProjectiles collision group. Because ALL projectiles by default are in this collision group, that means it would allow ALL projectiles to pass through it. (this would likely be the reason why it's never possible to have two projectiles collide with each other, they are both in the same collision group and this is not avoidable and we know there is no such thing as "removeFromCollisionGroup" command. )
However the c_CGStaticObjects collision isn't used by anything by default, thus you can use this collision group to achieve some interesting results. For example you can add a vehicle to this collision group, then create a special gate or other similar thing that only allows that said vehicle to pass through it. (keep in mind you need to add ANY solid child object of the host vehicle to the collision group as well since adding it to only the main PCO is not enough. All child objects with collision physics would need it as well).
This could be used on fences/walls to allow certain projectiles to pass through but prevent others from passing through. Or for allowing vehicles to pass through but not others. (note that this doesn't seem to work on soldiers correctly. They seem to lose the collision group setting after entering a vehicle. Thus if you enter a vehicle, then exit it, you are not longer in the staticObjects collision group. Vehicles can't enter other vehicles, thus they won't have this problem. )
The best example I can think of is "Bunker Buster" type weapons. This projectile will pass through a bunker that has been added to this collision group. Because no other projectiles are on this collision group, only the bunker buster will pass through it while everything else will collide with it like normal.
Example of how to achieve this. It's pretty simple actually.
Code: Select all
ObjectTemplate.create Projectile BunkerBuster ObjectTemplate.addToCollisionGroup c_CGStaticObjects
Code: Select all
ObjectTemplate.create SimpleObject ExampleBunker ObjectTemplate.addToCollisionGroup c_CGStaticObjects
Or you can create an invisible collision mesh that fits inside the collision mesh of the bunker without interfering with other projectiles/soldiers/vehicles. Then you can design it to allow certain areas for the bunker buster to pass through but make it explode on others.
But most bunkers in BF1942 are mostly one floor in terms of layout, so you won't have to do anything too complicated. Though if there is a big space under the floor like a big gap between the terrain and the floor, then you may need to add a invisible collision mesh below the floor to give something for the bunker buster to explode on since otherwise it may go to deep below to damage any players inside the bunker. If you encounter issues with explosion splash damage not working properly for projectiles that explode below the floor, you can instead make only the roof and walls part of the collision group and make the floor a separate object. Or put a invisible collision mesh a few microns above the floor. It won't be high enough up to impact unrelated collisions like soldiers/vehicles/other projectiles, but it will be solid to the bunker buster and allow it to explode above the floor so that splash damage works correctly.
I've tested this in my BFH mod real quick and it works flawlessly. I added a tree to the unused collision group, then added a vehicle and one projectile to it. They both pass through the tree while everything else still collides with it. I may post a video at some point showing it off at a later time if needed.
Any other creative ideas for this? I'm sure a wide range of things can be done with this.