No announcement yet.

swiping and accelerometer on physics object

  • Filter
  • Time
  • Show
Clear All
new posts

    swiping and accelerometer on physics object

    Hey guys,

    I'm kinda new to iOS development and have a couple of questions:

    1. lets say I have a top down view of a shoe box with a physics object in it. I'd like to be able to swipe the screen over the location of the object and have it react to the swipe by rolling around the shoebox.

    2. Same scenario as above but in this case the iDevice is held horizontal. I'd like the accelerometer to control the pitch and yaw of the shoebox. The result I am after is the object rolling around in the shoebox when I tip the iDevice. basically how most of those iOS marble games work

    I have all my object built and placed but just need help with these 2 interfaces (swipe an tilt) and how to implement them. Any direct suggestions or links to tutorials would be greatly appreciated.



    the method to go about it would probably something like this...

    1. detect where the user swips on the screen, probably looking through how epic got it working already with their tap to move functions.
    2. find out if the swipe goes on or near your object and what position.
    3. use addimpulse or addforce functions to make the boxes move accordingly.

    as for the accelerometer. somehow you should be able to just make the boxes positions and rotation equal to the location and position of the device