playMaker

Author Topic: [SOLVED ]Unity 2D, Proxies and Collision 2d Info  (Read 5246 times)

barichnikov

  • Playmaker Newbie
  • *
  • Posts: 9
[SOLVED ]Unity 2D, Proxies and Collision 2d Info
« on: January 21, 2014, 11:59:19 PM »
Hi,

I've been trying to make this collision thing happen for like an hour, and it must be something stupid I just don't see.

I have prefabs being instanciated at the top of the screen, and they fall down. They have a 2d collider and a rigidbody.

The player character is trying to catch those items with his mouth. The mouth has a collider that is a trigger. I put a 2d thing proxy on the mouth and the FSM has a listener for "TRIGGER ENTER 2D".

When the trigger happens, I want to destroy the prefab that collided with the trigger.

I tried Collision 2d Info and collision 2d event to no avail. I want to store the game object that collided with the trigger in a variable to then destroy it. I placed a breakpoint, and when the collision happens, it says the variable is none.

What am I missing?

Thanks.
« Last Edit: January 22, 2014, 08:15:35 PM by barichnikov »

failtruckz

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Unity 2D, Proxies and Collision 2d Info
« Reply #1 on: January 22, 2014, 04:28:21 AM »
If an object with a rigidbody and a collider is set to Kinematic = True then it will ignore all collision events.

There is a bug in 4.3 that means OnTrigger2D is also ignore any event when set to Kinematic = True, which is what you should use instead.

I spent 2 days trying to work this out, until I read about the bug.  epic FUUUUUUUUUUUUUUUUUUUUUUUUU!

:D

barichnikov

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Unity 2D, Proxies and Collision 2d Info
« Reply #2 on: January 22, 2014, 07:35:14 AM »
Hi,

Thanks for your reply, but that's not it. The collision happens, the event "TRIGGER ENTER 2D" gets sent to the mouth. What I'm missing is how to store the gameobject that enters the trigger.

It seems like I'm missing how to properly use "Get Collision 2d Info" or "Collision 2D Event", in order to act on those objects entering the trigger.

Any ideas?

barichnikov

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Unity 2D, Proxies and Collision 2d Info
« Reply #3 on: January 22, 2014, 08:15:05 PM »
Well, as I suspected, I was being dumb. I was using a trigger enter 2d, with a collision 2d info. I switched to trigger 2d info and it works (ofc)