Announcement

Collapse
No announcement yet.

No collision

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

    No collision

    Hi,

    I'm stuck on something and hoping someone has a suggestion. I have lots of collision classes: bullets, ships, ground, etc... And collision is working great for almost everything.

    There's just one collision that won't work, ship vs ground. Ships collide with bullets correctly, ground collides with bullets correctly, and so on. But that one combination of ship and ground refuses to work.

    Obviously, I have a typo somewhere, but I have looked for hours and can't find it. What is really confusing me is that every other combination works. That means that my collision shapes are good.

    Here is what I have tried:
    • Calling SetCollisionResponseToAllChannels(ECR_Block) for both ships and ground, to make sure it's not an issue with a specific channel
    • Changing from OnComponentHit.AddDynamic() to OnComponentBeginOverlap.AddDynamic() to see if overlaps work (they don't)
    • All possible values of ECollisionEnabled in SetCollisionEnabled()
    • Setting bGenerateOverlapEvents
    • Setting up collision in BeginPlay() instead of the constructors


    And still nothing. I can post code if there's some particular part that would help. I'm just looking for an idea of where to start debugging because this has really stumped me.
    Level 17 The Ladon Device

    #2
    Did you also call Set Collision Object Type on the component??
    Code:
    UPrimitiveComponent::SetCollisionObjectType(ECollisionChannel::ECC_PreferdChannel)
    Try it out and let me know how it turns out.
    WCode

    Comment


      #3
      The only gotcha I can think of is if you are changing these settings in code, but are using a blueprint in the level that may have overriden the settings. I'd check the collision setting on the objects in-game to verify its ok.

      Comment


        #4
        What actors and components are using the ground type? Is it a landscape actor or an ordinary static mesh/collision shape?
        Journeyman's Minimap - Available on Marketplace - Forum topic - Video

        Comment


          #5
          One thing to watch out for, and I've had this issue any of times. You place an actor in the world via Blueprints, you save the level, change some defaults in your C++ class, recompile and try again and nothing happens. It's because your placed actor doesn't update its variables, you should delete the actor and place it again.
          Pocket Sized Animations

          Comment


            #6
            Did you also call Set Collision Object Type on the component??
            Yes, it's there, and it looks like that code is correct...

            I'd check the collision setting on the objects in-game to verify its ok.
            Good idea, should have thought of that.

            What actors and components are using the ground type?
            It's a procedural ground made up of tiles. So each tile is an actor, created with SpawnActor(), with a single mesh component. I set the collision settings on the UStaticMeshComponent.

            You place an actor in the world via Blueprints
            Good idea, but they're all spawned from C++ with SpawnActor().

            I'm going to double check these suggestions, then I'm going to just revert the code back a few days and start over.
            Level 17 The Ladon Device

            Comment


              #7
              I ripped it all out, typed it all in from scratch, still no luck.

              Here is something that might be a hint... the first time I add the code, I hit the following assertion failure:

              DelegateSignatureImpl_Variadics.inl, line 1192, method "__Internal_BindDynamic"
              Code:
              ensureMsgf(this->IsBound(), TEXT("Unable to bind delegate to '%s' (function might not be marked as a UFUNCTION)"), *InMacroFunctionName);
              I hit that same assertion that the first time I tried, but I just kind of overlooked it because it went away. It hits once but then seems to go away when I rebuild.

              Anyone else run into that assertion?

              EDIT: I checked the obvious suspect and the function is marked as UFUNCTION().
              Last edited by Pat-Level17; 06-02-2015, 01:46 PM.
              Level 17 The Ladon Device

              Comment


                #8
                This is just mind boggling.

                I've tried everything that I can think of. I verified that all collision channel settings are correct in game, as WCode and AusPaco suggested. Ship is set to block ground and ground is set to block ship.

                I put debug output text in every "OnHit()" function of every actor. Sure enough, when a bullet hits the ground, I see "bullet_xxx hit ground_yyy" and when a bullet hits the ship, I see "bullet_xxx hit ship_yyy." But no output is ever generated for ship vs ground.

                I enabled "Show Collision" in the console and I can see that the collision shapes are exactly where they should be and they are very clearly overlapping.
                Click image for larger version

Name:	collision.png
Views:	1
Size:	480.5 KB
ID:	1079305

                I also enabled "ShowDebug Collision" and couldn't see anything helpful there.

                Any other debug information I could look at?
                Level 17 The Ladon Device

                Comment


                  #9
                  Perhaps it's in your movement code and not your collision. I would suggest possibly changing your Ship's Collision to "Block All" and do some tests, if it's not working still that would tell you it's probably not a collision issue as Block All should do just that. You can also try Overlap All, which should call Overlap Events if it's setup right.
                  Pocket Sized Animations

                  Comment


                    #10
                    Just out of curiosity - are you attaching anything to ship by welding? I've had all sorts of issues with that - including collision issues. If you are, try not attaching anything so there is no welding and see if collisions now work correctly.

                    Comment


                      #11
                      Irish, I tried what you suggested and the ship passes through some things but not others. Ships pass through other ships, ships pass through the ground, but bullets collide correctly with ships (and ground). Does that suggest a problem with movement?

                      Movement is done like this, inside Ship::Tick():
                      Code:
                      RootComponent->MoveComponent(velocity * delta_seconds, rotation, true);
                      ... where "velocity" and "rotation" are just variables computed each tick. So I don't know if that's a common approach, but I didn't use any "movement components," etc...

                      Originally posted by AusPaco View Post
                      are you attaching anything to ship by welding?
                      Sorry, what's welding? The ship is made up of a few different actors. The root is an empty USceneComponent. I do this because the player can build his ship at run-time.

                      The other actors (those shapes that you see in the image) are attached to the ship's root using AttachRootComponentTo() and I position them with GetRootComponent()->MoveComponent().

                      If there's a better way to attach actors to actors, please let me know and I'll try it.
                      Level 17 The Ladon Device

                      Comment


                        #12
                        Pat, I'm also struggling trying to get something similar working and it's driving me INSANE. I tell you this so you know you're not alone. Maybe we can get a discount on group therapy?

                        If you are just using the default arguments of AttachRootComponentTo, then you aren't welding, so it's probably not that.

                        The only thing I can think of to try is to reset your collision settings on the ship after you attach something. Does the ship collide with the ground if you DON'T attach anything, ie, just the base mesh?

                        Comment


                          #13
                          Good idea, AusPaco, I tried resetting the collision channels after attachment but it didn't make a difference.

                          But your suggestion made me think of something... I have these attached actors and I'm moving the root with the "sweep" parameter set. That "sweep" might not propagate to the attached actors.

                          So I did some searching and that might be the case:
                          https://answers.unrealengine.com/que...ts-actors.html

                          In that thread, Tom S says: we do not perform collision sweeps sub-components when detecting collisions with characters.

                          That certainly seems like what I'm seeing, however, he's talking about "characters" and I'm not using a character class.

                          Still, this is almost certainly the problem, so, the question becomes how do I work around this? I really need these actors to sweep.
                          Level 17 The Ladon Device

                          Comment


                            #14
                            Yes, this has to be the problem. More evidence:
                            https://answers.unrealengine.com/que...r-from-mo.html

                            Zak M says: when we sweep a component in MoveComponent(), we only sweep the root component and then teleport attached children

                            That is really, really, really unfortunate. I need a workaround for this.

                            Can I somehow grab the collision shapes from the attached actors and move them up to the root actor?
                            Another idea would be to not attach the other actors and move them all individually (this sounds awful).
                            Is this something I could patch in the engine code? I've never modified the engine code, is it difficult?
                            Level 17 The Ladon Device

                            Comment


                              #15
                              This sucks.

                              somehow grab the collision shapes from the attached actors and move them up to the root actor
                              This won't work because A) I don't think the engine supports it and B) I wouldn't know which actor was colliding because all the collision shapes would belong to the root

                              not attach the other actors and move them all individually
                              This is exactly as horrible as I expected it to be... I lose all the benefits of attachment, I would have to calculate all relative rotations and movements manually, it's a nightmare

                              I could really use some advice from someone at Unreal on this... any chance that this will be implemented in 4.8?
                              Level 17 The Ladon Device

                              Comment

                              Working...
                              X