(That makes the Apex cloth collides only with the pawn, not with the entire world and this gain a lot of speed).
I want to do it optionall, but I don’t know how to change, I can’t find a command like “SetRBCollidesWithChannel” but working for ApexClothing.
My solution for now is to extend a new class from skeletalmeshcomponent, changing only that default property, and in game, spawn one or another class when creating the cloth.
There is another way to do, like “SetRBCollidesWithChannel” does with the rigid bodies?
It’s not currently working because it’s set as a const in SkeletalMeshComponent.uc.
/** Types of objects that this clothing will collide with. */
var(ApexClothing) const RBCollisionChannelContainer ApexClothingRBCollideWithChannels;
You could simply remove the const from the var definition. I always try to never modify the native code, but I have done so an various occasions (a few of them were also removing a const like this). Make sure all changes are tracked in version control obviously (git).
For instance, I removed the “const” from FogDensity in ExponentialHeightFogComponent, so I could update it via script for my weather system.
Thanks I had to remove some “const” from fog and lights too for the day/night cycle and others. I will see how to assign the
RBCollisionChannelContainer, removing the const before.
I tried to remove the const. I also had to remove the const’s in the struct, in PrimitiveComponent.
Then I made a function to test it, and it gave me an error when trying to change the value of Default in the struct. It told me that it was a const, when the const was removed from the struct.
I still tried without the Default value (the others has no problem), and it didn’t work, the cloth collided with everything in both cases. I believe that precisely it’s the “Default” value that is necessary. But I don’t know how to solve the “const” error when I had already removed it.
My other solution works well, but in order to simplify the code, is there a way to set in a variable the class I want to create?
For example, something like this.
local class C;
C = class’SkeletalMeshComponentNOCOLLIDEWORLD’; //the modified class to collide only with pawn
if (VARclothcollideswithworld) { C = class’SkeletalMeshComponent’; } //the normal class to collide with all
NewComponent1 = new C;
NewComponent2 = new C;
NewComponent3 = new C;
…
This obviously doesn’t work, but is there a way to do it? Some variable type that can contain a class?