playMaker

Author Topic: Colliders problem  (Read 115 times)

krmko

  • Sr. Member
  • ****
  • Posts: 422
    • View Profile
    • Fat Pug Studio
Colliders problem
« on: November 06, 2017, 03:11:38 AM »
I'm having a banal problem, and i can't believe what's happening. I've got the Gunpoint Object that is attached as a child of the player, with these settings:




When it comes in contact with Pickup in the scene




an event should be triggered





I've set the Layer Collision Matrix, Z positions are aligned (2D game, everything uses 1 for Z transform value), i even tagged the Pickup Prefab, but still no collision is detected. I must be missing something banal, i tried all sorts of combinations of rigidbody types, istrigger checked or not, discrete/continuous collision detection and nothing works  >:( >:( >:(



600

  • Sr. Member
  • ****
  • Posts: 493
    • View Profile
    • Car and Traffic Playmaker assets
Re: Colliders problem
« Reply #1 on: November 06, 2017, 03:59:08 AM »
Seems like the Box collider (the trigger) component is disabled in the second image.

krmko

  • Sr. Member
  • ****
  • Posts: 422
    • View Profile
    • Fat Pug Studio
Re: Colliders problem
« Reply #2 on: November 06, 2017, 04:02:03 AM »
Sorry, i forgot to mention i activate it on runtime since same weapon objects are on the gunpoint and as a pickup, and i still didn't make the fsm to activate it or not whether it has a parent or not, so disregard that and consider it active.

600

  • Sr. Member
  • ****
  • Posts: 493
    • View Profile
    • Car and Traffic Playmaker assets
Re: Colliders problem
« Reply #3 on: November 06, 2017, 04:06:40 AM »
Do you have child objects as trigger in different layers?
I had problems when having separate colliders as triggers each in different layers under one parent, I think it is a Unity compound collider bug. My trigger did not work when I create/instantiate at runtime, the work around was to have it in the scene from the beginning and then activate/deactivate when needed.
Check out in test scene where you have all On and Enabled already without runtime spawning enabling/disabling.
Depending on you requirements that can be a work around, spent a week to find it :D
Of course not sure if this is your case too..

600

  • Sr. Member
  • ****
  • Posts: 493
    • View Profile
    • Car and Traffic Playmaker assets
Re: Colliders problem
« Reply #4 on: November 06, 2017, 04:12:06 AM »
Oh and the most annoying thing for the bug was, it will work on editor, not on a build, so it was really time consuming to debug  :(

krmko

  • Sr. Member
  • ****
  • Posts: 422
    • View Profile
    • Fat Pug Studio
Re: Colliders problem
« Reply #5 on: November 06, 2017, 04:13:40 AM »
I do, it goes like this:

Player - Collider2D with non IsTrigger, Player Layer
     Gunpoint - Collider2D with IsTrigger, as attached in the image, Gunpoint Layer
          PulseGunLevel1 - Disabled Collider2D with IsTrigger, Pickup Layer

Actually the PulseGunLevel1 which is a child of Gunpoint object is the same object that Gunpoint should collide with (that means there are two instances on the scene). Since they both spawn on runtime, that is the reason that i have, for testing purposes, disabled the collider on the prefab, so it stays disabled on the instance childed under the Gunpoint object, and i enable it manually on the pickup instance. I made so many layers to make sure nothing collides unintentionaly since there's obviously a problem.
« Last Edit: November 06, 2017, 04:16:56 AM by krmko »

600

  • Sr. Member
  • ****
  • Posts: 493
    • View Profile
    • Car and Traffic Playmaker assets
Re: Colliders problem
« Reply #6 on: November 06, 2017, 04:26:28 AM »
Try taking triggers out and make them follow with Get/Set Position as the original parent.
This also fixed one of my trigger logics and making it separate with another FSM with position everyframe did not impact performance.

I think it would be reasonable to check this to exclude or confirm the layer+collider+parent bug and if it is not the case, perhaps something with the logic with states.

krmko

  • Sr. Member
  • ****
  • Posts: 422
    • View Profile
    • Fat Pug Studio
Re: Colliders problem
« Reply #7 on: November 06, 2017, 04:34:02 AM »
I tried something a bit simpler, i made an FSM for testing if triggering works fine. It works with player collider, trigger collision is detected. Looks like it's a bug definitely.

600

  • Sr. Member
  • ****
  • Posts: 493
    • View Profile
    • Car and Traffic Playmaker assets
Re: Colliders problem
« Reply #8 on: November 06, 2017, 04:36:30 AM »
Forgot to mention, that I asked a programmer to do Trigger scripts to check if it's Playmaker related and the results was the same, so it must be Unity bug or parent limitation.

krmko

  • Sr. Member
  • ****
  • Posts: 422
    • View Profile
    • Fat Pug Studio
Re: Colliders problem
« Reply #9 on: November 06, 2017, 04:44:36 AM »
I tried moving the FSM from Gunpoint to Player, same shit. Unbelievable. I'll have to use get distance and just disable the function if the object has parent, but i can't believe this happens.

krmko

  • Sr. Member
  • ****
  • Posts: 422
    • View Profile
    • Fat Pug Studio
Re: Colliders problem
« Reply #10 on: November 06, 2017, 10:14:13 AM »
Or i may have another idea to see if it's unity problem, i'll write a small script in c# to test it.