playMaker

Author Topic: Collision Detection doesn't work for Box2D object  (Read 1831 times)

weilies

  • Junior Playmaker
  • **
  • Posts: 74
    • View Profile
Collision Detection doesn't work for Box2D object
« on: April 20, 2016, 04:16:24 AM »
Dear gurus,

i am able to trigger playmaker collision enter event if i created 3d object.
but it doesnt work when they are 2d objects. i realize the different is i ise box 2d insread box component. it just doesnt trigger collision enter event.

can show me some pointers?

Thamks

regards,
weilies

Zeldag

  • Full Member
  • ***
  • Posts: 198
    • View Profile
Re: Collision Detection doesn't work for Box2D object
« Reply #1 on: April 20, 2016, 04:58:11 AM »
Hi,

Well Im no guru, just a noob who has been through something simmilar, so this isnt really adressed to me, but I think I can help :)  :

First of all, you need the 2d action pack, foud here: https://hutonggames.fogbugz.com/?W1150
(or on the Ecosystem).

Download and import it, you will then have 'trigger 2d event' and 'collision 2d event' actions, which you should use for 2d collision/triger events.

So basically from my understanding (sorry if it is too basic), 3d and 2d objects use different physics systems/engines in unity. So if you wanted to use a 2d collider, it would also need a rigidbody 2d not a regular rigidbody.

As a result I dont think a 3d object can collide with 2d objects.

So if your entire project is 2d, as a first step ensure youre using a rigidbody 2d component on the object you are trying to collide with and download the action pack I linked to- then youre all set. (also search for a vector 2 action pack, it may be useful for a 2d project)

If your project is indeed a mix of 2d and 3d then I think the workaround would be to position a 3d collider (and regular rigidbody) on the 2d object that you want your 3d character to collide with and all should work fine.

Anyway I hope this helps. Good luck with it!

(edit: oops had wrong link posted, fixed now)
« Last Edit: April 20, 2016, 05:04:03 AM by Zeldag »

weilies

  • Junior Playmaker
  • **
  • Posts: 74
    • View Profile
Re: Collision Detection doesn't work for Box2D object
« Reply #2 on: April 20, 2016, 02:47:14 PM »
Thanks but  this package was obsolete, cant be use anymore in latest unity version. i run into error whenever i drag the prefab into scene (as guided in doc)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3643
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Collision Detection doesn't work for Box2D object
« Reply #3 on: April 20, 2016, 08:09:07 PM »
What version of Unity are you using? The package may need updating for the Unity 5.4 Beta... Jean would have to take a look...

BTW, 2D Physics will be integrated in the next Playmaker update so you won't have to download an addon.

weilies

  • Junior Playmaker
  • **
  • Posts: 74
    • View Profile
Re: Collision Detection doesn't work for Box2D object
« Reply #4 on: April 20, 2016, 09:23:28 PM »
I am in v5.3.

I managed to make it work if I add the PM unity2d component to selected item and not the prefab. It's just not as per documented :)


Thanks! And hopefully it's more integrated