Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: joduffy on August 14, 2013, 01:29:27 AM

Title: Custom Playmaker Scripts with ARToolkit
Post by: joduffy on August 14, 2013, 01:29:27 AM
Hi Guys,

I am writing custom actions for ARToolkit to have it work with playmaker.

What I am trying to do is create an action that will detect when a marker is visible or not.

The AR plugin is all contained in a dll file and you can access the needed data from events:

Events
The TrackedCamera generates the following events, using Unity's SendMessage command. To handle these events, implement the matching event handler in a script, and attach it to the TrackedCamera.
void OnMarkerLost(Marker marker)
void OnMarkerFound(Marker marker)


http://www.artoolworks.com/support/library/ARToolKit_for_Unity_Scripts#Events (http://www.artoolworks.com/support/library/ARToolKit_for_Unity_Scripts#Events)

My problem is that, even though I include the two needed methods in my custom action it doesn't work.

Is playmaker events or setup stopping the ARToolkit events from being activated?

I have attached a working c# script and my playmaker action.

I am just lost over why it is not working. Any help would be greatly appreciated.
Thanks guys.
Title: Re: Custom Playmaker Scripts with ARToolkit
Post by: jeanfabre on August 14, 2013, 03:14:39 AM
Hi

Actions are not components. That's where you are getting confused.

To reach an action this way, you'll need a "proxy" or in other word a component that receives ARToolkit messages and then forward it to playmaker as PlayMaker events.

Does that make sense?

If you are still struggling let me know.

bye,

Jean
Title: Re: Custom Playmaker Scripts with ARToolkit
Post by: joduffy on August 20, 2013, 12:46:39 AM
Hi Jean,

Thanks for replying.

So what you are saying is that you create a script that playmaker subscribes itself to. Like how NGUI is handle with UIEventsToPlaymakerFSM.cs.

http://hutonggames.com/playmakerforum/index.php?topic=1356.0 (http://hutonggames.com/playmakerforum/index.php?topic=1356.0)

So if I create a script that will make certain data available I can have playmaker access it. So what you are saying is that it is a two stage process.

You cannot simply contain it all within an action?

Would this be the same principle you would apply to make Kinect and playmaker work together?
Title: Re: Custom Playmaker Scripts with ARToolkit
Post by: jeanfabre on August 20, 2013, 03:06:17 AM
Hi,

 Yes, you are on the right path.

 It must be a two stage process because "Actions" are not component so they won't receive messages sent by other frameworks. So you insert a component that has everything it needs to listen to the framework and then you forward to your action using Fsm events that you trigger manually within your component.

Bye,

Jean
Title: Re: Custom Playmaker Scripts with ARToolkit
Post by: joduffy on October 01, 2013, 09:08:12 AM
Hi Jean,

I had done the ARToolkitToPlaymakerFSM and thought I would share it incase others have the same problem.

Please find attached the script and screen shot on how to use it along with a document. The document was written to provide alternatives to scripts that people try to use with ARToolkit.

I am currently in the process of doing Kinect, Leap and Vuforia.

Title: Re: Custom Playmaker Scripts with ARToolkit
Post by: jeanfabre on October 02, 2013, 02:39:34 AM
Hi,

 Excellent! I am looking forward your leap implementation! I have one, but never had the time to properly port it to playmaker... It's quite a task to provide something useful and generic enough.

bye,

 Jean