I’m trying to create a projectile that gets launched from a cannon and once it collides with the player or a shield it gets destroyed. I made the cannon but I can’t get the projectiles to destroy on collision.
But it’s just this in the projectile actor:
Perhaps it’s a matter of phrasing…
What is supposed to get Destroyed
?
- projectile
- shield
- player
- anything the projectile hits
- all of above
Ok that worked I was using component hit instead of event hit. There’s one other thing for some reason the bullets only get deleted if the collide with a moving player do you know why that is
Sounds suspicious. With the above it should get destroyed regardless of what it hits, regardless of the target’s mobility.
It’s not just that the bullet just passes through the player.
Do you adjust the player collision in some way when they move / stop? Perhaps the capsule gets scaled - people sometimes adjust its size to squeeze the player into tighter spaces.
What you describe is uncommon so all I can do is guess, unless you demonstrate the behaviour in a lot of detail.
Root component of a projectile should be a collision component. Mesh and fx should be children. The mesh collision should be set to “no Collision”.
Create an On Component Hit event for the root collision component. Use this event to determine hits, dmg, and when to destroy the projectile.
Further, if using a full body character (e.g. third person character) you want projectiles to hit the skeletal mesh, not the capsule component. To set this up you simply need to create a new collision object channel dedicated to the capsule component.
PawnCapsule - Collision Object Channel
You’ll probably want to create a Projectile object channel as well. Have the pawncapsule ignore projectile and have projectile ignore pawncapsule.
I tried this it’s not working, the projectile just passes through the actor when the character isn’t moving. For reference the projectile works like this
Aaaahhh You aren’t using Projectile Movement Component (PMC).
I’d highly recommend you do. There’s more to projectiles than simply moving a collision. Being technical w/your code above you should be moving the entire actor, not just a component. You also need to do sweep checks along the way.
Projectile movement in itself is point to point… frame location to frame location. “Move to” nodes do not sub step.
Think of it as sequential teleporting positions along a path. Depending on velocity, gravity etc there can be large spaces between each point. So technically you aren’t literally moving the actor through space overlapping the entire path.
On fast moving projectiles that have a small collision (bullet), you may need to do sphere traces point to point to catch all possible hits. On tick trace current to last.
Is your character custom or do you use Character movement Component (CMC)?