playMaker

Author Topic: Unity 2D and Physics 2D Support now available  (Read 39575 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Unity 2D and Physics 2D Support now available
« on: November 15, 2013, 05:02:11 AM »
Hi Everyone!

 Finally gathered the first package for Unity 2D.

 The most important in Unity 2D to take control over with PlayMaker is the new Physics 2D engine. With this package, you can now receive Triggers and Collisions events in your Fsm very much like with the normal Physics engine.

You can download now the package on the wiki:

https://hutonggames.fogbugz.com/default.asp?W1150

The wiki documents how to set up your scene to enable PlayMaker and Physics 2D to work together. If you have any questions, let me know.

I am currently working on refactoring the Unity 2D game Sample from the asset store, so.

 More actions will be added to this package as we go, so don't hesitate to make requests and hilite what you would like to see supported next.

 Bye,

 Jean

4ppleseed

  • Full Member
  • ***
  • Posts: 226
Re: Unity 2D and Physics 2D Support now available
« Reply #1 on: November 16, 2013, 05:25:54 PM »
I'm getting the 'Assets/PlayMaker Unity 2D/Scripts/PlayMakerUnity2d.cs(3,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?' error when I try to export to Webplayer.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Unity 2D and Physics 2D Support now available
« Reply #2 on: November 17, 2013, 12:50:50 AM »
D'oh!

 I rushed the editing features it seems...

Simply delete the "PlayMaker Unity 2D" Folder and redownload form the wiki. Sorry about that.

Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Unity 2D and Physics 2D Support now available
« Reply #3 on: November 17, 2013, 12:59:33 AM »

Any chance that "Mouse Pick Event" soon will be able to handle 2D Physics to?


Hi,

 Yes, this will come next as I finish the refactoring of the Unity Sample.

 Bye,

 Jean

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
Re: Unity 2D and Physics 2D Support now available
« Reply #4 on: November 20, 2013, 04:56:32 PM »
Is there any way to make the 2D Collisions and Triggers work like Collision Event and Trigger Event? as the current system really limits what i can do.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Unity 2D and Physics 2D Support now available
« Reply #5 on: November 20, 2013, 11:16:55 PM »
Hi,

 They actually are exactly the same in their implementation, can you be more precise as what you experience?

Bye,

 Jean

cloud03

  • Full Member
  • ***
  • Posts: 249
  • Viva Playmaker!
    • Milkish Game Studios Blog
Re: Unity 2D and Physics 2D Support now available
« Reply #6 on: November 21, 2013, 01:01:03 AM »
Hi jean, this is my first post, and I've really excited learning playmaker so far...it is a really great tool...

I'm wondering with the playmaker 2d add ons, how do I add force or velocity to 2d rigidbody game object? is it already possible?

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
Re: Unity 2D and Physics 2D Support now available
« Reply #7 on: November 21, 2013, 03:20:42 AM »
Hi Jean

Ok so we have an object listening for triggers or collisions to happen, i've found the main problem is i can't define which collisions or triggers its listening for like i can with Trigger Event or Collision Event, instead the moment that object collides with anything all Collision Enter globals are called and some of them i don't want to call until the object collides with other objects.

So yeah i can't figure out a way to define what objects are colliding with each other via Tag like i can with Trigger Event and Collision Event


EDIT
Turns out i was over thinking things and after a little more experimenting i now understand how it works.

So thanks again Jean :)
« Last Edit: November 21, 2013, 02:45:33 PM by MrMitch »

cloud03

  • Full Member
  • ***
  • Posts: 249
  • Viva Playmaker!
    • Milkish Game Studios Blog
Re: Unity 2D and Physics 2D Support now available
« Reply #8 on: November 22, 2013, 07:56:32 AM »
Sorry for asking again, but for 2d we only have get collision info 2d and get trigger info 2d for action, how do we manipulate 2d objects using action such as add force, set velocity and others that are compatible for 2d objects?

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
Re: Unity 2D and Physics 2D Support now available
« Reply #9 on: November 24, 2013, 01:43:34 AM »
How i did it was store the object hit in the Game Object Hit variable, then used the action Game Object Compare to compare the objects and send an event.

Phillament

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Unity 2D and Physics 2D Support now available
« Reply #10 on: November 25, 2013, 05:22:06 AM »
How i did it was store the object hit in the Game Object Hit variable, then used the action Game Object Compare to compare the objects and send an event.

Hi, I've tried what you said and I can't seem to get it to work. I'm also really new with this. I've attached images of what I have so far. Any help would be greatly appreciated.

Update:
Okay so I've got the 2D collisions working. Now I want to be able to specify what happens when certain collisions happen. In my game you're a ship that shoots missiles, and if you hit an asteroid then it gets blown up. so far that part works, but I've found that the asteroids get destroyed even when the ship hits them. I don't want this to happen and I was wondering how I could make sure only missiles destroy asteroids?
« Last Edit: November 25, 2013, 06:22:21 AM by Phillament »

cloud03

  • Full Member
  • ***
  • Posts: 249
  • Viva Playmaker!
    • Milkish Game Studios Blog
Re: Unity 2D and Physics 2D Support now available
« Reply #11 on: November 25, 2013, 09:00:19 AM »
one way to do that, after the event "collision enter 2D", create a state between that contains "get collision 2D info" action, and store the game hit to a variable, and then compare the game objects, if its the missile, send the event to a state that'll destroy the asteroids, else do nothing...

Phillament

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Unity 2D and Physics 2D Support now available
« Reply #12 on: November 25, 2013, 08:28:52 PM »
one way to do that, after the event "collision enter 2D", create a state between that contains "get collision 2D info" action, and store the game hit to a variable, and then compare the game objects, if its the missile, send the event to a state that'll destroy the asteroids, else do nothing...

Thanks for the quick response. I'm trying to figure out what you are explaining, but I keep failing. Here are some pictures of what I have so far. What should I fix?

cloud03

  • Full Member
  • ***
  • Posts: 249
  • Viva Playmaker!
    • Milkish Game Studios Blog
Re: Unity 2D and Physics 2D Support now available
« Reply #13 on: November 25, 2013, 09:44:05 PM »
Here is what I do, the robot shoots arrowIcon when fire1 pressed, and the robot have different tag with the arrowIcon, for the Crate Object, I created a FSM that listening for collision on the first state (first state does not contain any action at all), with Transition Collision enter 2D, when any object collides with the crate, it will automatically activate that transition.

On the second state, the first action will store the game Object that hits the crate, and we will check if that game object have certain tag that we're testing, if its true, then go to destroy, else it will go to Don't destroy transition. I've tested it, and it works, the crate only can be destroyed if its collides with arrowIcon, if I try to move the robot to collide the crate, it will not be destroyed.

hope this helps (I've attached the FSM for the crate)

Phillament

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Unity 2D and Physics 2D Support now available
« Reply #14 on: November 25, 2013, 10:18:17 PM »
THANK YOU SOOOOO MUCH!! ;D  ;D ;D
This is exactly what I was looking to accomplish. It'll also help for when I'm trying to do other things. I'm still learning the basics of PlayMaker so this kind of thing is a (relative) quantum leap, hahah. I hope your day is going well!!