Has anyone figured out great tilt control for GS?

goliathgoliath Member Posts: 1,440
edited November -1 in Working with GS (Mac)
Hello all, in case you missed it, my game SpaceScape has been released and the #1 complaint (even though I really don't have any issues with it at all) has been the controls.

You fly your ship with the touch of a finger but people keep saying the ship gets lost under their finger, even though I added an offset.

I have been toying around with the idea of adding strictly touch control but it needs to be perfect. If anyone out there has added tilt control to their title and are happy with it, please let me know what's the best way to do it so I can add it to spacescape. Any help would be much appreciated. thanks!!!
«1

Comments

  • HachikoHachiko Member Posts: 330
    If tilt X is greater than 0.1, or less than -0.1, constrain self position X to self position X+(10*accellerometerX)

    If i'm not mistaken, I use this and I am pretty happy with it. I tried other ways, like constraining the max speed to abs(accellerometer*number) and then adding an accellerate behaviour based on the accellerometer direction, and it worked well too, but I prefer the first one.
  • Rob2Rob2 Member Posts: 2,402
    the big thing with a good tilt control is smoothing and inertia....look at low pass filters ;) but unfortunately GS simply can not do the kind of super smooth controls you will see from a native app.
  • goliathgoliath Member Posts: 1,440
    Is there any way you can make a quick template for me to download?
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I've done what hachinko suggested (with 15 instead of 10) and it feels exactly like doodle jump or if you use it on both X and Y it feels exactly like tilt to live. One problem - constrains always trump physics, so your spaceship will not bounce off things, though I have not had problems with using invisible walls to contain the actor within a boundary, but restitution does nothing because of the constrains.
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Scitunes, you just inadvertently solved a problem for me... I've been having issues with stuff moving that shouldn't... restitution has been no help. I'm going to set up invisible actors and constrain the moving ones to them so they won't bounce! THANKS HEAPS!!!!
  • goliathgoliath Member Posts: 1,440
  • goliathgoliath Member Posts: 1,440
    goliath said:
    so make an attribute called tilt?

    sorry for so many questions I am still learning...
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    In your player just use two constrain behaviors

    constrain self.positionX to self.positionX + (game.accelerometerY*10) {it is switched for landscape. If you have it the landscape the "other way" you may need to try - instead of + and if it is portrait then use x for x and y for y}

    constrain self.positionY to self.positionY + (game.accelerometerX*10)
  • HachikoHachiko Member Posts: 330
    POLYGAMe said:
    Scitunes, you just inadvertently solved a problem for me... I've been having issues with stuff moving that shouldn't... restitution has been no help. I'm going to set up invisible actors and constrain the moving ones to them so they won't bounce! THANKS HEAPS!!!!

    Can't you just have a self attribute containing the initial Y or X position of the actor (put a change attribute self attribute to self position Y or X so that at the start of the scene everything is set)
    and then constrain the Y or X self position to this self attribute? No double actor, should be less performance killer.
  • goliathgoliath Member Posts: 1,440
    would either of you make a quick template for me to download? you both sound like you know exactly what you are talking about so i'd like to try each one....
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Hachiko said:
    Can't you just have a self attribute containing the initial Y or X position of the actor (put a change attribute self attribute to self position Y or X so that at the start of the scene everything is set)
    and then constrain the Y or X self position to this self attribute? No double actor, should be less performance killer.

    Oooooh... thank you!
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Although... wouldn't that stop the asteroid from moving altogether? Problem is I want it to move right to left but not be affected when hit by other objects...
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I would spawn a new asteroid with new rules and then immediately destroy the original.

    Working on a quick demo of tilt control now.
  • goliathgoliath Member Posts: 1,440
    Thanks Scitunes! I cant seem to get it!
  • AfterBurnettAfterBurnett Member Posts: 3,474
    I just tried it, constrained the X to self.x... no idea why but it works! Can't seem to get the problems to reoccur! Will need more testing, though ;)
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Search the shared projects in the GS start menu for "Silky Smooth Tilt Demo With Calibration"

    I added a calibrate button so you don't have to hold the device flat if you don't want to. works from about 0 to 60 degrees.

    enjoy!

    P.S. remember that physics will not work with the actor you are controlling with this methods (i.e. bouncing off other actors)
  • AfterBurnettAfterBurnett Member Posts: 3,474
    My mistake... didn't work :(
  • goliathgoliath Member Posts: 1,440
    thanks man.... ill try it out now....
  • goliathgoliath Member Posts: 1,440
    now if only i can get that damn GS viewer to work....
  • AfterBurnettAfterBurnett Member Posts: 3,474
    lol.
  • goliathgoliath Member Posts: 1,440
    I hate it dude. Honestly. I haven't figured it out yet how to do it and I always just download the project and put it into itunes (mind you once I find the correct freakin profile because I have like 10 that don't work)..... now I am getting some weird error message...

    Sorry.... I guess I am just having a bad day....
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Lol, I have the same issues... although I've been too lazy to install the viewer. I just use ad hoc builds and GS with a Joypad to test :)
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    you must build the viewer with xcode. itunes is not part of it at all. There are new step by step directions in the manage portfolio section of the website. follow it EXACTLY.
  • HachikoHachiko Member Posts: 330
    Sorry I couldn't make a template! I hardly have time to work on my project, even tough I'm on holyday, I'm more busy now then when I have school. (20 years old there :)
  • goliathgoliath Member Posts: 1,440
    Hey Scitunes.... Side to side (left to right) works perfectly but I am getting now up and down movement...

    Any ideas?
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Is this in reference to my demo? Because when I tested it it worked fine.

    Are you holding the device horizontal with the button to the right?
  • goliathgoliath Member Posts: 1,440
    Yes. I will make sure the actor has everything as well.
  • goliathgoliath Member Posts: 1,440
    Still not working. I am trying the game on my ipad and left to right works flawlessly, it just wont go up and down.

    I appreciate your help...
  • goliathgoliath Member Posts: 1,440
    Scitunes, should your demo work for the ipad as well? I am just wondering because up and down is still not working...

    I plan on trying it on my iphone tonight but we will see.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    i'll try it on the iPad and let you know. I have only tested it on my 2nd gen iTouch. But I have the exact same rules in an iPad game that works fine.
Sign In or Register to comment.