Hey UE4 wizards!
Quick question that might be complicated to achieve but I'll give it a try. I am making a sidescrolling action game (metroidvania etc) where my player character can only melee attack, dealing damage using MultiSphere Tracing.
I now have an enemy turret.
However, since my player character cannot shoot, he needs to be able to destroy them. Creating the logic to destroy the turret using my melee attacks is easy and done but now I want my player character to be able to reflect the turret's projectiles towards it to destroy it, or kill other enemies that cross the bullet's path.
The turret shoots a static mesh projectile (actor blueprint) that has no collision (for now). The overlapping of the capsule collision on the bullet deals damage to the player, the destroys the actor.
I have looked a bit on the topic and I gathered that my projectile should be able to bounce to create the desired effect.
My logic to go about this would be something like this: I want the bullet to do a MultiSphere trace during it's movement that, upon hitting something (if it's the player character and if he's attacking) will reflect the projectile directly towards the origin (no fancy movement or whatever, just a 180 degree rotation and reflected with the same velocity).
How would I go about that?
The only code (blueprint) I have for now is the overlapping collision of the capsule that deals damage to the player. I have tried to implement my logic using a sequence on the On Component Begin Overlap (Capsule) but I'm pretty sure it's not the way I'd have to set it up.
Thanks in advance!
asked Jun 27 '19 at 03:06 AM in Using UE4
Hey, all you should have to do is to Get the current Velocity and negate it and ofc apply that result again. something like this, hope it helps.
answered Jun 27 '19 at 04:25 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here