Announcement

Collapse
No announcement yet.

Projectile hitting caster

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

    Projectile hitting caster

    I've read all that I could find on this issue but I'm still having the problem with the projectile hitting the caster on spawn. I've tried the following with mixed results:

    1. set collision of spawned actor to "Always Spawn, Ignore Collision" <-- object spawns but then immediately collides with the actor who spawned it.

    Click image for larger version

Name:	solution2.PNG
Views:	42
Size:	142.2 KB
ID:	1693884

    2. set projectile collision to BlockAllWorldDynamic <-- seemed to work for a while but then didn't on repeated tries.

    3. set projectile collision to Custom with custom collision channel -> collision query only -> ignore pawn <-- seemed to work at first but didn't on repeated tries. Also tried creating a separate channel for the player and having the player identify as that channel.

    Click image for larger version

Name:	solution32.PNG
Views:	50
Size:	43.9 KB
ID:	1693882

    4. on collision hit for particle collision body -> get instigator -> if instigator is not other actor -> do stuff <-- this also seemed to work at first but then later didn't. If the projectile is hitting the instigator it just stops moving.

    Click image for larger version

Name:	solution4.PNG
Views:	41
Size:	131.9 KB
ID:	1693883

    The only solution that gives a passable result is moving the socket out of the ship's cannon but then if the ship is moving fast enough, it will hit it anyway.

    For the collision body, I'm just using a sphere collision.

    Click image for larger version

Name:	collision.PNG
Views:	41
Size:	83.2 KB
ID:	1693885



    #2
    I'm going to assume you're using the Character Class (not Pawn) as your parent class. This would mean you have a Capsule Component and a Mesh and the Spawned projectile is hitting the capsule component.

    If this is the case you want to create a new Collision Object Channel for your Capsule Component. .... I named mine "PawnCapsule".
    Project Settings -> Engine -> Collision

    Click image for larger version  Name:	collisionobject-channel.jpg Views:	0 Size:	52.5 KB ID:	1694016



    In your character class set your Capsule Component collision preset to "Custom" and object type to "PawnCapsule". Then set "Projectile" to ignore under collision responses.

    Click image for larger version  Name:	CapsuleCollision.jpg Views:	0 Size:	41.3 KB ID:	1694017

    Next adjust your projectiles collision settings to Ignore "PawnCapsule".

    Click image for larger version  Name:	projectilecollision.jpg Views:	0 Size:	40.5 KB ID:	1694018

    The end result is the projectile won't collide with any player capsule. It'll be character mesh dependent.

    Comment


      #3
      Originally posted by Rev0verDrive View Post
      I'm going to assume you're using the Character Class (not Pawn) as your parent class. This would mean you have a Capsule Component and a Mesh and the Spawned projectile is hitting the capsule component.

      If this is the case you want to create a new Collision Object Channel for your Capsule Component. .... I named mine "PawnCapsule".
      [I]Project Settings -> Engine -> Collision

      In your character class set your Capsule Component collision preset to "Custom" and object type to "PawnCapsule". Then set "Projectile" to ignore under collision responses.

      Next adjust your projectiles collision settings to Ignore "PawnCapsule".

      The end result is the projectile won't collide with any player capsule. It'll be character mesh dependent.
      I appreciate the response. But I have already tried this as mentioned in my 3rd solution. Here is the setup:

      Click image for larger version

Name:	exampl3.PNG
Views:	39
Size:	12.8 KB
ID:	1694222

      Projectile Collision (Sphere)

      Click image for larger version

Name:	solution32.PNG
Views:	35
Size:	43.9 KB
ID:	1694223

      Player Mesh (static)

      Click image for larger version

Name:	exampl4.PNG
Views:	35
Size:	41.7 KB
ID:	1694224

      Though my player isn't a character, it's a pawn with a static mesh. I have had mixed results using the pawn collision setting though. My static mesh does have a convex collision body which interacts using physics in the world. Another issue I've run into is when I set the custom collision object to player, my player does not spawn and I cannot move.

      Comment


        #4
        Hi, you can use "Ignore Actor when Moving". Plug in your Projectile Collision as Target and the shooter (instigator) as Actor. Then the Projectile will ignore this actor.Click image for larger version

Name:	ignore_actor.png
Views:	29
Size:	44.5 KB
ID:	1694275

        Comment


          #5
          Originally posted by chrudimer View Post
          Hi, you can use "Ignore Actor when Moving". Plug in your Projectile Collision as Target and the shooter (instigator) as Actor. Then the Projectile will ignore this actor.Click image for larger version  Name:	ignore_actor.png Views:	0 Size:	44.5 KB ID:	1694275
          This only seems to work with the collision of the projectile set to Custom and Query Only (no collision). But it does work and it allows for instances of the same player to shoot each other. Thanks.

          Click image for larger version

Name:	Capture.PNG
Views:	19
Size:	42.8 KB
ID:	1694414

          I am a bit of a stickler Meeseeks though. I mean, in any other application, if I write some form of "if(collide with parent){collision = false}" it works. Only in Unreal does stuff work so so half the time.
          Last edited by SeldinG; 12-04-2019, 07:50 PM.

          Comment


            #6
            Also, I seem to have figured out my collision issue with using custom collision channels. In an earlier post I stated that custom collisions on my pawn with an object type set to Player caused my pawn to not spawn. The "Player" channel is set to block with the laser or projectile set to ignore. As seen below:

            Click image for larger version  Name:	Capture3.PNG Views:	0 Size:	41.3 KB ID:	1694417

            Click image for larger version  Name:	Capture2.PNG Views:	0 Size:	474.1 KB ID:	1694416

            Apparently, ticking pawn to "ignore" solves this. But why?

            Click image for larger version  Name:	Capture5.PNG Views:	0 Size:	41.3 KB ID:	1694419

            I mean, it works until tomorrow. Seriously though, why does this tick matter? Setting collision to blockall or blockalldynamic allows the pawn to spawn fine despite it being set to block on both. Sigh...
            Attached Files

            Comment


              #7
              You need to post pics of your pawn/mesh setup (viewport) so we can clearly see what you're doing. The Laser socket also needs to be clearly identified (location).

              Comment

              Working...
              X