playMaker

Author Topic: Custom Playmaker Scripts with ARToolkit  (Read 3765 times)

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Custom Playmaker Scripts with ARToolkit
« 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

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.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Custom Playmaker Scripts with ARToolkit
« Reply #1 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

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: Custom Playmaker Scripts with ARToolkit
« Reply #2 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

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?
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Custom Playmaker Scripts with ARToolkit
« Reply #3 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

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: Custom Playmaker Scripts with ARToolkit
« Reply #4 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.

- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Custom Playmaker Scripts with ARToolkit
« Reply #5 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