i have a project of spaceship from top and some troubles with collisions between projectiles and pawns.
-Pawns correctly collide with each other. (as expected)
-Physical projectiles correctly collides with each other. (as expected)
-Physical projectiles pass through pawns. (that is not expected)
-Each pawn and projectile have a static mesh as root component with collision boxes set in the mesh.
-Projectiles have a projectile movement component attached to the root component (they are on the same lv)
-When a projectile is fired, the channel is set to no collision at first, then on the event beginplay i set collisions on physics and query.
Here are my trace channels and how i set my projectiles.
So i’d love to have my pawn and projectiles generate hit and overlap when they collide with my projectiles so i could do the logic for them, what is actually blocking me in the project so far.
“…-Each pawn and projectile have a static mesh as root component with collision boxes set in the mesh.”
I’m pretty sure you need to set the collision box as the root component, not the static mesh. I know this is what fixed a lot of collision issues for my game.
Generally speaking, you need objects to overlap, not block… Then, with an “OnBeginOverlap(Box)” event, you deal damage to the Other Actor (then maybe spawn an explosion effect at its location, etc).
I havent figured it out yet but remember this rule:
Collisions between two objects will be the kind that is the least blocking between the two. so if a No-collision object and an overlap-only object meet, the collision is a No collison.
If an overlap-only and a blocking object meet, it will make an Overlap.
So the only way to get a Blocking hit is for both objects to be Blocking on that channel. You can’t make it block one but overlap on the other. It is only overlap both or block both or nothing both in the resulting interaction.
Based on how yor channels are set up, I think it should work though, once you turn on collisions. Thats strange.
i wonder if it is resetting the channels or something when the collisionEnabled changes?
The static mesh have it’s own collision, that what i mean, they are set in the mesh editor.
I don’t know, i tested a bit with 2 ships facing each other and shooting rockets, when the rockets hit each other that works all fine cause it trigger the explosion defined with the “onhit” event.
But with exactly the same setting and in the same game if i shot those rockets on the ships it just pass through, while both are supposed to be “block”.
I posted here cause i’m not sure it’s a bug or not as there are many issues with collisions (i read a lot the forum and ask about this issue) but couldn’t find a way to resolve my issue so far.
And i would add, before i didn’t activate the collision with begin play and have them set fine from the start, but it was doing weird things like it seem to collide with the instigator from time to time. But … It was still passing through other pawns … So i thought it would make less interference this way.
I really can’t find a workout about my issue and don’t even really know if it’s a bug and should be reported.
Why are your physics actors set to “no collision”? They should default to “collision enabled query and physics”. Second, check EACH component of your projectile and spaceship actors, especially the components higher up in your hierarchy and make sure they are all set to the same collision properties. It could be that one of your components doesn’t have the same collision properties as the others and it is causing issues.
Like i wrote in my main post “-When a projectile is fired, the channel is set to no collision at first, then on the event beginplay i set collisions on physics and query.” to avoid the projectile to collide with the instigator.
Secondly, i have only one component that have a collision box, should i set even those with not collision set to the same channels?
Anyway i put all the components of my pawns to the same collision it did not change anything.
I don’t know if you read my first post but i will detail anyway.
I tweaked a bit the thing. My rockets collides with the instigator pawn when i set the collision to all in my projectile channel, but they do not collide with other pawns.
I add that my pawns collides with each other and they do collide with my invisible walls delimiting the arena.
I made some test to see if the channel was being reset after the collision change and the game displayed a new channel that was custom and it was expected, and the setting for pawns collision is still set to “block” so it shouldn’t be an issue again.
So the channel isn’t reset or at least the collisions stays as they should.
Could it be that my pawns that are not possessed are processed like another type of object in the game?
Cause actually it’s the only thing i could think about with my issue.