Download

Portal Gun Issues... Help?

So I’ve recently been trying to make a portal gun in UE4. Nothing crazy. My problem is that when my projectiles hit an object, they destroy themselves, but don’t spawn the portal. Here are my blueprints for the projectile and portal. Help?

http://imgur.com/hATpi0v <----------Projectile

http://imgur.com/mATmRv1 <----------Portal

(I’m sure you know, but just copy and paste the link into your browser for the images)

Thanks in advance for any advice!

you answered your own question, follow the logic of this statement. your projectile BP’s first node is to destroy it’s self, it therefore never executes the rest of the code.

also, as you get all actors of class, you don’t need to cast, as you already have access to it, the blue note on the cast node will tell you this.

Thanks for the help. I actually have tried rearranging the destroy node, but I’ll try again and see if it works.

Yep go easy on driving game logic from a projectile with limited lifespan, which itself might be a factor here.
Its the player / pawn / character BP that should be responsible for this, as they’re the one creating portals.
So call a custom event on the Pawn instance, or use AnyDamage event etc, or put the logic in Gamemode…

Hey franktech, thanks for the response. To be honest, I’m really new to Unreal, and haven’t dabbled into game development much yet. I’m still quite young, so I have much to learn. If you could help me out on this project, or just dumb down what you said, that’d be great. Thanks!

There’s loads of first person / third person shooter templates about.
You just need to dissect one of these to glimpse some best practice.
At the moment you’re putting too much gameplay code in projectiles.
That functionality should reside inside the Pawn / Character instead.

Again, I’m still learning, but how can I put a script (or blueprint) in the character that controls what happens when the projectiles collide and make them spawn portals?

In short, send a ‘message’ out from the projectile to the character BP to let them know etc…
How do you do this? … The projectile has a Collision event that tells it that it hit something.
It also tells it what actor got hit. This is a common method used in many projectile tutorials.

After, call Apply-Damage on the hit actor and it will raise a damage event inside the Character.
Or create a custom event inside the Character BP to which you link your Spawn-Portal code etc.
Watching a few projectile tutorials will help you a lot here, or take apart some free templates…

Thank you so much for your help!