How can I set SkeletalMeshComponent to be the true dealer of character collisions?
Hi, I'm working on a blueprint character and want to get more accurate collisions between characters so events such as Overlap or Hit don't fire when the characters' CapsuleComponents collide but when the actual skeletal meshes collide (imagine a character punching another one, it's not desired that the Hit event fires when the CapsuleComponents collide, but when the hand/fist part of the first mesh collides the other mesh).
So the problem I've encountered is that for Characters there's apparenty some kind of hierarchy or prioriy order between diferent components for collisions, it seems that the root/base is the character's CapsuleComponent and that the SkeletalMeshComponent isn't actually used for collision; I say that because if I set the collision type of the capsule to be NoCollision, it doesn't matter the type of collision for the mesh (BlockAll, Ragdoll or wathever), even the Mesh has a correct PhysicsAsset, the character falls of the world as it didn't have collision. If the Capsule's type is another, Pawn for example, the character doesn't fall.
So how can I set the SkeletalMeshComponent to be the true holder or dealer of character collisions instead of the CapsuleComponent? The capsule is marked as "[ROOT]" in the character Blueprint Components and it's not possible to take the seketal mesh component away from inside of the "[ROOT] CapsuleComponent" hierarchy, or create another mesh component outside of it.
Hello, Bob Chatman has told me when hat in another project he also needed to use mesh based collisions and that he solved it adding this line to the constructor of this character. It's important to know in his case he was working with a StaticMeshComponent, not a SkeletalMeshComponent as I, and that was subclassing from Actor class, not Character as I do.
With this line he achieved that the Mesh was the root of the character (would be marked as "[ROOT]" in blueprints), and so, the true dealer of the collisions. I want to do this trying to make my SkeletalMeshComponent to be the root, and so, the collision of the character would be mesh-based.
Although my character is purely BP based, it extends from a nearly empty class that subclasses from Character.cpp (as it was generated in the 3rd person C++ template).
I've added that line to the constructor and it compiles fine, but in the editor the character shows no changes. It might be some overriding going on, but I can say I haven't modified anything related to RootComponent in my blueprints or code, so must be something from the default engine stuff.
Do you have any ideas on how to make this work or can point any clues on the general question of the thread? Any suggestions would be very welcome.
answered May 07 '14 at 06:29 PM
You can use ComplexCollsion (ie test against actual geometry) in Collsion queries. But I don't think this option is available to normal collision checks.
However try setting the 'Trace Complex on Move' property from the editor for this Actor. I have not tested it, but might work. Form doc: "Trace Complex on Move If this is set to true, component sweeps with this component will trace against complex collision during movement. Complex Collision is, in short, per face collision, where as Simple Collision are your spheres, capsules, boxes, and generated convex shapes."
Actually, from Print String I see that the element in the top of the collision hierarchy seems to be a hidden collision cylinder (like the one used for pawns in UDK), possibly part of the CapsuleComponent. This doesn't change much, though, unless until I find out or someone can answer how to revert that hierarchy and put mesh collisions as the priority; another solution would be a a dynamic generation of collision-hulls option for skeletal meshes (like the ones for static meshes but generated over time, so they are animation consistent, this could be interesting, as it wouldn't be as bad for performance as a per-poly collision model for skeletal meshes), but that is not available.
Is there any properties native for the Character actor and its subclasses to prevent the skeletal mesh from colliding? If so I would like to know how to disable it. Any information would be appreciated.
OK, so I've made so the Hit event, when fired, prints the components that collide from both blocked and bumping actors. The capsule is just a bit bigger than the character in iddle pose, but when in punching animation the mesh has a bigger extension in horizontal direction than the capsule.
What I'm going to explain happens the same way with different collision types (BlockAll, Pawn, CharacterMesh) for the SkeletalMeshComponent and the CapsuleComponent as long as both have ticked the Simulate Hit events option:
a) If the two characters are very close, so the capsules are touching each other, the Hit events print many messages at once: at the same time the meshes collide one with another, the capsules collide between them, and each capsule collides with each mesh. So this is a correct or expected behaviour.
b) If the two characters aren't so close, so the capsules aren't in contact, if one characters fires the event that plays the punch animation, the fist of the first character passes through the mesh and the capsule of the other character, but no Hit event seems to be fired, as no printing is done. This is not desired at all, I want to make it so collision always generates Hit events when blocking actors bump like in this exposed situation.
Do you know how to solve what explained in "b"? It seems like the collision Hit event of the mesh with the other mesh and capsule isn't fired because character requires the first's capsule to also be colliding at the same time (I say this because of what I've explained in "a").Analizing the exposed situation it seems that the mesh component is discarded or ignored for Hit collisions if the capsule isn't colliding as well. It might be because of another fact, though.
Any help or suggestions on the matter would be really welcome.
Follow this question
Once you sign in you will be able to subscribe for any updates here