Does a collision box generate overlap events if it collieds with another collision box?
I have 2 actors, both have a sphere collision box and somehow i get 2 overlap events,when i’m moving to the other actor, maybe one for the box and one for the actor?
The whole purpose of collision primitives is to generate collision and overlap events on their actors when they hit another collision primitive. The purpose of collision primitives is to simplify the calculations needed to detect collision. So what you do is to use a simple object, like a sphere for example, and wrap it around your complex mesh. The collision sphere now represents your character in “collision world”. The collision detection will only look at the sphere instead of the complex mesh beneath it.
So if you have a collision sphere (or a collision box) on each Actor and they overlap, each collision primitive (box, sphere, etc) will generate an overlap event on its actor. You will receive two overlap events, one on Actor1 and another on Actor2.
Nope. Every mesh you create, even if it is a Static Mesh, must have a collision mesh associated with it. Otherwise it won’t collide in UE4.
If you double click a Static Mesh in your assets for example, it will open the Mesh Editor. There you will see the “Collision” button in the toolbar on the top of the screen. This button highlights the current collision meshes associated to the static mesh. So every mesh must have one or more collision meshes to be able to collide in UE4.
What you can do though is turn off Hit and/or Overlap event generation. Just uncheck the “Simulation Generates Hit Events” or “Generate Overlap Events” in the Collision section.
I want to check if a character is close enough to another one to be able to attack him.
I’m not sure if a collision box is the apporach here, but anyway, the radius where a character is able to attack another one, is larger than the model. If the enemy model(not enemy collision box) is inside this radius he can attack
OK, In this case, I imagine you have a separate collision sphere component in your characters blueprint, apart from the collision mesh of the character itself.
What you need is to tweak the collision presets of your collision sphere. Go to your character blueprint and select your sphere collision component. In the parameters, go to the Collision section and open the Collision Presets folder. By default the collision sphere is set to OverlapAllDynamic.
What you want is to overlap with the Pawn only.
Collision Preset: Custom…
Collision Enabled: No Physics Collision
Object Type: WorldDynamic
Now, in Object Response, set everything to Ignore except the Pawn. Leave Pawn as Overlap.
This should make the collision sphere generate an overlap event only when it hits the smaller collision mesh of the actor itself, but not his own collision sphere.