Can’t decide which trendy tech bandwagon to hop onto? Try them all at once!
Okay – so I’d never recommend mixing all this crap together in a real world app, but it was fun just to give it a go and see what would happen. Thought maybe the internet would explode or something.
To see what I’m rambling about, check out the experiment here.
You’ll need this augmented reality marker (just ignore the “right hand”/”left hand” business). When prompted, allow webcam access in the Flash portion of the experiment (bottom left). Hold the marker upside right towards your camera (a green rectangle will appear around the embedded flash when the marker is detected) and spin it like a steering wheel to steer the car in the Unity3D portion of the experiment (top center). The harder you steer, the more purpley the background will appear (that’s the HTML5 canvas bit).
Here’s a little screenshot below for those not interested in being bothered by all the hassle…
404?
link fixed.. user error.. never could figure out this whole ‘internet’ thing…
I was curious, how you are communicating with Unity through Flash? I assume you’re using Flash (ExternalInterface) to call Javascript function(s) in your page. I looked over the page source quickly but didn’t find what I was looking for. Let me know how you pulled this off if you don’t mind. Good work.
Hey Derek, in essence, the Flash file sends the rotation of the AR marker to a js function (using ExternalInterface). That function sets the color of the canvas background and also passes the rotation on to Unity which normalizes the value and uses it to steer the car rather than the normal horizontal input. One thing I found, if you remove the canvas background color change, the app actually runs quite smoothly. Meaning, using Flash and Unity for AR is actually a viable thing…
A little hard to steer, but it’s a fun experiment :)
can u share the code please
Some time ago I’m trying to connect unity & flash through sockets, but fail.
Reasons described here:
http://answers.unity3d.com/questions/980/connect-flash-unity-through-an-socket-connection
@Peko – I used a simple javascript connection rather than socket although the socket idea is an interesting concept. It’s a shame you couldn’t get it to work.
@Hellen – the code is a bit of a mess – I just took an old AR project and and changed it around a bit adding and deleting so it’s very disorganized. If I get some time to clean it up, I’ll post it. The whole concept is quite simple though. Just take the z rotation of your AR marker (see how to get rotations in this old post: https://blog.onebyonedesign.com/?p=254) and pass it to a javascript function with ExternalInterface. Pass that value to the Unity object to steer the car (you can find plenty of Unity3d driving tutorials and, if you want, do a view source to see how the value is passed – it’s fairly easy).
d.