Vibrations

Forum for J2ME mobile games related topics including programming doubts, books and other resources for J2ME game development

Vibrations

Postby ladty » Sat Nov 22, 2008 12:05 pm

Hi,
I'd like to know, is there any "minimal allowed duration" on which I can set vibrating (by Display.vibrate(i))? Because even if I set vibr. duration to 50 millis, it's the smame as 5 millis (and in real it's vibrating for more than half second (500 millis and more, can't say exact number)). I don't want it to really vibrate for some time, only to 'jump' a little (max 1/20s). Is it possible, or is there any minimal limit? In documentation is nothink about some limit, but in real it's just vibrating too long. I also tried somethink like:

Code: Select all
double startVibrTime;
booloean vibrating = false;
int vibrDuration;

public void vibr(int dur) {
     vibrDuration = dur;
     display.vibrate(dur);
     vibrating = true;
     startVibrTime = System.currentTimeMillis();
}

public void run() {
     .....
     if(vibrating) {
          if(System.currentTimeMillis()-startVibrTime > vibrDuration) {
               display.vibrate(0);       // stop vibrate
               vibrating = false;
          }
     }
     .....
}

But no success, still vibrating at least about 500 millis like before... Any ideas? Must it always vibrate for some time before it stops? :(
User avatar
ladty
 
Posts: 24
Joined: Wed Jul 09, 2008 10:36 am
Location: Czech republic

Re: Vibrations

Postby DevelopmentTeam » Sat Nov 22, 2008 12:16 pm

From What I understand from my past experience with vibration, each device has its own minimal duration for vibration depending upon its hardware. May be longer duration works fine but very shorter duration is not really possible in few devices. So I guess its better not to expect vibration in few milliseconds, as if you study how the vibration is generated its by runing a motor and it takes sometime to give the vibration effect. I guess expecting your mobile to vibrate to less than 500 milliseconds is impossible.

meanwhile, on which device are you testing?
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: Vibrations

Postby ladty » Sat Nov 22, 2008 2:47 pm

I'm testing on N93 (and sometimes N73); but emulator is doing the same in this case (sound of vibrations is also about 500millis long). So I'll use vibrations only in cases where I can "afford" longer vibrations and less frequently...
Thanks :-)
User avatar
ladty
 
Posts: 24
Joined: Wed Jul 09, 2008 10:36 am
Location: Czech republic

Re: Vibrations

Postby DevelopmentTeam » Sun Nov 23, 2008 5:18 am

Yes, that should be the best idea. Most gamers don't like vibration as it drains the battery few times faster than usual.
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India


Return to J2ME Games

Who is online

Users browsing this forum: No registered users and 1 guest

cron