"Fly" through 3D scene (with a USB HID controller)

Hi Vuo community,

I’ve been visuals with Quartz Composer until now, and just yesterday decided to switch to Vuo.
Having played around with Vuo the whole day yesterday, I’m starting to feel comfortable with the Editor already (no surprise, coming from QC).

There is one thing I would love to accomplish, though, which seems to be equally difficult in Vuo as it is in QC:

**I would like to “fly” my camera through the 3D scene, using a controller, like in a video game. (anyone remember the Descent series? :))
**

Now, what I’ve accomplished so far, is that I can transform the Z-axis of the camera to dolly forwards and backwards using the left analog stick of my controller, then use the right analog stick to control the rotation along the Y and X axes. (I use the “count” node just as I would use the “integrator” in QC)

What now happens is this: when I “look” to the right (i.e. Y axis 90deg) and push my left stick forward to dolly forwards, the camera actually strafes left, because the Z axis is no longer in line with the camera. Makes sense, right?

**So my question is this: How can I make the camera translation “follow” its rotation? Is there an easy way, or do I have to manually calculate the 3D translation according to the current rotation?
**

I hope I made myself somewhat clear. Unfortunately I don’t have a composition file to attach, because I’m still waiting for my academic discount to be verified.

Thanks a bunch!
Charles

1 Like

Without sitting down with Vuo, I’d think that you’ll have to get a directional vector from the rotation, and then use that to accelerate the camera towards the direction you are facing. I’ve been trying out a few nodes for such things lately, but as summer is extremely busy I’m not sure when they’ll be posted. Looking at Daniel Schiffmans ‘Nature of Code’ can probably also be of interest as it pretty much can be translated to Vuo.

2 Likes

FlyThru-strafe.vuo — Tried to recreate your composition as you described it, @microlomaniac. Simplified: Only rotates on y-axis. Keyboard controls.

FlyThru-turn.vuo — Implemented @MartinusMagneson’s suggestion of a directional vector.

FlyThru-strafe.vuo (6.32 KB)

FlyThru-turn.vuo (11 KB)

1 Like

Thank you Magneson, thank you Jamie! That’s a great starting point. I’ll go ahead and make this thing 3D.

For anyone who’s interested, I’ve attached my current WIP (still only y-axis rotation) plus a node I’ve made for combining game controller and keyboard inputs, with optional visualisation. WASD = left stick, arrow keys = right stick. As soon as I add the buttons I’ll share the node to the gallery.

/edit: I’ve simplified the composition a little, and implemented X axis rotation. Now I can walk around and look around, which is already quite nice. Now on to refreshing my knowledge about Pytagoras’ theorem… :)  

microlomaniac.gamepadCombiInput.vuo (36.7 KB)

FlyThru-turn_e.vuo (13.7 KB)

1 Like