playMaker

Author Topic: Use iPhone as window into a 3d world  (Read 2590 times)

JeppeNygaard

  • Playmaker Newbie
  • *
  • Posts: 7
Use iPhone as window into a 3d world
« on: November 27, 2012, 04:47:45 PM »
Hi All,

I've build a 3d environment and I would like to be able to explore this world through my iOS device. Like the iPhone becoming a window into this world: when the iPhone rotates the camera in the 3d world rotates with it. And I ONLY need rotation. The user will not need to change position. So I guess "all" I need to know is how to map the rotation of the device onto the rotation of the world camera.

I've tried using the "get device acceleration" but the problem is that when I start rotating the device the world keeps spinning even if I stop rotating - it only stops when I face the iPhone downwards.

Has anyone tried this before and can you give me a hint of how to proceed?

Thank you so much!

Jeppe

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Use iPhone as window into a 3d world
« Reply #1 on: November 28, 2012, 12:46:40 AM »
Hi,

What are actually doing with the values from "get device acceleration"? It's likely that you should adopt a different approach to camera control, but it's difficult to point at the problem without knowing exactly how you process acceleration.

bye,

 Jean

JeppeNygaard

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Use iPhone as window into a 3d world
« Reply #2 on: November 28, 2012, 01:11:42 AM »
Hi Jean,

Thank you for your reply!

I guess my problem is that I don't really know how to handle the acceleration data, or how to utilize this to create a virtual-reality-type control of my 3d camera. Currently I've just mapped the float values from the accelerometer into the rotation of the camera (please see the attached jpg), this clearly wasn't the right solution - what would be the correct one?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Use iPhone as window into a 3d world
« Reply #3 on: November 28, 2012, 01:52:20 AM »
Hi,

 Have you tried the "Get device roll" action, maybe this will ease your task,

bye,

 Jean

JeppeNygaard

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Use iPhone as window into a 3d world
« Reply #4 on: November 28, 2012, 02:20:08 AM »
I did try that one - but it felt like this was mostly applicable if I wanted to use the device as a steering wheel in a racing game (rotation around the device's z-axis) - what I need is actually for the device to handle x and y rotation of my world camera.

Thanks
Jeppe