Hi, I have taken a copy of the MyCharacterBP and I am modifying it for my game. The Blueprint uses a Capsule for collisions. Is there a way i can use my characters body for collision (to make the mesh itself interact with the world geometry and other objects), or at least change the Collision Capsule to some other shape (like a box or a capsule that is not the same length and width)?
If you are using the CharacterBlueprint of the examples you have to stick with the capsule for now, the reason is that the CharacterMovementComponents requires it. From that you have to options, create a totally new new movement components or play around with the height and width of the capsule. Using the whole mesh for all collisions is a bad idea because it will cost a lot but the mesh is actually used for traces such as bullets to be precise.
If you still want to go the route to create you own movement component you have to create a new Character in C++ that changes the default movement component set by ACharacter. You can do that using your characters constructor:
AMyNewCharacter::AMyNewCharacter(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer.SetDefaultSubobjectClass<UMyNewMovementComponent>(ACharacter::CharacterMovementComponentName))
{
// Your Character Movement Component is now using your own class.
}
To be able to achieve your goals you should look at the implementation of UPawnMovementComponent and UCharacterMovementComponent.
If you set the radius and the half-height to be the same you will have a sphere.
Can I at least change the capsule to be a square Volume somehow?
Yes you can, not as the main collision component though but it will work. Just add a new BoxComponent to your BluePrint, and set the collisions to BlockAllDynamic.
Is there a way i can add another Component and use its collision instead of the one of the root component?
That didn’t work, i even tried Block all
I converted the geometry to meshes, now it works, thanks a lot.
Nice! Remember to accept the answer to help others ^^
Are you still having issues? If not just resolve the answer ^^
Cheers,
Moss
Hi I am also trying to customize the collision of characters. Could you explain more of “converted the geometry to meshes”? not quite sure what is means. thanks!
Please open a new question for it to help others with the same issues: https://answers.unrealengine.com/questions/ask.html
If the answer relies on someone saying “I converted the geometry to meshes, now it works, thanks a lot. :)” and the other saying “Nice! Remember to accept the answer to help others ^^” then surely asking “Could you explain more of “converted the geometry to meshes”? not quite sure what is means. thanks!” - is still related to this question. I also want to know what they meant, because I don’t know what the crucial bit of the answer means. Why new question, when the answer is not sufficient for at least 2 people, probably more…
When I google “UE4 converted the geometry to meshes” it is nothing related to this question - the requirement is specific to this question, so posing a new question based on this would involve explaining the whole context of the original question here…
I agree, this isn’t a very well answered question.
What I would recommend is that you change the collision type of your capsule.
then you can ignore that type with other objects.
For example, I set my capsules to Pawn and my character meshes to Skeleton
Now I ignore Pawn collisions with the mesh which is set to Skeleton.
The effect for me is that I use the capsule collision for some things but not for character interactions.
Thank you learningOver for taking the time to share your insights. So for a character that has a head that protrudes outside of the default capsule, how would you have to set up collision for a box collision component that you add to the head, so it actually stops the character when they bump into a wall? Currently, only the default capsule will stop the character from penetrating, the extra collision component does nothing.
Thanks!
Thats the main issue, if you use the default CharacterMovementComponent you are forced to use a capsule. Even if you ignore pawns for it it will sfill be used for movement collisions with the world (plus network predictions etc.). So what you can do is to write your own movement component that handles something different than a capsules.
Thank you, Moss, for your helpful reply. Currently writing my own movement component would be outside the scope of my skill set, but perhaps eventually I would be able to achieve this. For now, I’m just using a resized capsule component that tries to best approximate my mesh.
Have a good day.
~Adam
Hey guys, any update on the set character collision to mesh thingy?