playMaker

Author Topic: Sorry I talked garbage about Playmaker not being able to handle objects.  (Read 7740 times)

kiriri

  • Hero Member
  • *****
  • Posts: 506
In reply to this: http://hutonggames.com/playmakerforum/index.php?topic=2356.msg10431#msg10431
I'm sorry amaranth and the rest of you guys, I was ignorant. Here's how it works.

In my first example I'll address a problem I've just solved and which somewhat enlightened me: I want to set the mesh of one gameObject to the mesh of another. How did I do that? With objects of course ^^.

1) I created 2 new object variables, the one I called "renderer", the other I called "mesh".

Now, that on itself won't do anything desirable. That is because Playmaker can't read which type of object the two variables may become. So instead of showing all the options for all the different types, it only shows inherited stuff when we try to use it in "Get  Component". (If that didn't make sense, just ignore it and continue reading :) )

2) I actually click again at the variables I just created and on top of the options I got when creating them, they now offer to become a very specific type of object. For my renderer variable I open the list, press U to jump to UityEngine, which will in turn fan out into an even larger list. Now, the arrow to scroll down misses here so I press 4 x M to select the "MeshFilter" object type.
I do the same for the "mesh" variable, but instead of mesh filter I select "Mesh" (2 x M).

Now we're basically already done, all that's left is to create some actions to actually do stuff.

3) I create a get Component action with any target I like. I store the component as "renderer". Then I use get Property and get the mesh of "renderer" and save it as "mesh". Now I repeat the getComponent action on the Owner/ the game Object that contains the FSM. I save the component again as "renderer" since I don't need the previous Component it contained anymore. Then instead of getting the mesh, I set it using Set Component.

And voilá (the accent should be the other way around but I can't find it on my keyboard),
the mesh is set to whatever you wanted it to be.

The same goes for amaranth's problem. Once you notice that you can define the type of an object within playmaker, a whole new world of possibilities opens up. So if you've got any questions or comments, feel very free to comment, ask, critique :D
Best,
Sven

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Sorry I talked garbage about Playmaker not being able to handle objects.
« Reply #1 on: October 08, 2012, 08:19:51 AM »
Hi,

 Can you reference that post in its original thread? then people will be able to follow, thanks,

bye,

 Jean