Announcement

Collapse
No announcement yet.

Enemy/obstacle collision 2D

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    I haven't used Paper2d much, but you should be able to make a box that is a component of your player and enemy characters directly in the blueprint component screen. One way I solved this same problem ages ago with a platforming game I did was that I put an invisible collision box at the feet of the player that killed enemies when it collided with them. It was a kind of sloppy solution though, as it meant if you were moving fast enough horizontally or hit it at just the right angle, you could kill enemies without actually having hit the top of them. The raytracing used in my proposed solution is supposed to fix this issue by making sure that the enemy is indeed below the player.
    DO contact me with questions about Blueprint or other Unreal features! I don't bite! Or charge money! Just press that blue Skype button and fire away.

    Project Culverin - Open Ended First Person Shooter

    Comment


      #17
      Thanks a lot. I will be trying it all out, and will get back with the result

      Comment


        #18
        Originally posted by zlspradlin View Post
        I have an idea. I'm at work so I don't want to drill into what Ray posted at the moment. But another idea that might work for you, especially if you're going to make a lot of enemies is this:

        You can set up trigger volumes (which would be like a hit box) on the enemies head. When the character overlaps that trigger volume then you can destroy the actor (your enemy) (you may need to play a death animation > then destroy actor for immersion). I've also not tested this but it could be as simple as this:



        Now, you'd want a specific box. See how it says "Trigger box copy" ? That's because I made a trigger volume, named it trigger box (made a copy for this thread), and when my character walks through it the game will spawn an enemy. Instead of the game spawning an enemy, your game will destroy the actor. There are other options besides overlap, like hit, if you want a collision and not to just pass through it.

        In the image above you'd place that in your character blueprint. As long as you only ever used your "kill box" (whatever you name your trigger volume) on enemies, then whenever the character/player overlaps with that box that enemy (actor) is going to die (be destroyed). You don't want to use that box on other instances or things, because you might accidentally destroy whatever instance of whatever you applied it to if your character triggers that function (don't put that same trigger volume on a platform or something, if your character landed on the kill box he'd destroy the platform and you'd fall down into nothingness or a kill box or whatever).

        The target "other actor" feeds into the "destroy actor" because you want the OTHER actor (not your character) to be destroyed.

        I can give this a test run later when I'm out of work.

        edit; for quick testing you can use an "attach to" function to attach the trigger volume to a socket on your enemies head (You'd have to look at the skeleton and make a socket in the right spot). If you're not sure how you'd get the trigger volume on your enemies head this a quick way to test it.
        I've tried it out. The TriggerBox is attached to the mummy, I made the blueprint like you did. However, it doesn't seem to do anything at all in the actual game

        Comment


          #19
          I'd like to thank both of you. I've succeeded with the problem. Simply by trying and testing, and I've made it work.

          I've made my normal damage collisions work as well as the kill collision by use of the trigger.

          Thanks to both Ray Jones 321 and zlspradlin

          Comment

          Working...
          X