Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: weilies on April 20, 2016, 07:16:24 AM

Title: Collision Detection doesn't work for Box2D object
Post by: weilies on April 20, 2016, 07: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
Title: Re: Collision Detection doesn't work for Box2D object
Post by: Zeldag on April 20, 2016, 07: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)
Title: Re: Collision Detection doesn't work for Box2D object
Post by: weilies on April 20, 2016, 05: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)
Title: Re: Collision Detection doesn't work for Box2D object
Post by: Alex Chouls on April 20, 2016, 11: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.
Title: Re: Collision Detection doesn't work for Box2D object
Post by: weilies on April 21, 2016, 12:23:28 AM
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