Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / joystick throttle

Author
Message
The Wilderbeast
19
Years of Service
User Offline
Joined: 14th Nov 2005
Location: UK
Posted: 12th Apr 2006 21:55
i'm making a flight sim, but with the throttle my joysticks is reverse. so at o% it reads 1000 and at 1000% it reads -1000, how can i get it so that 0%=1000?

OMG It's the Wilderbeast
Dark Eternity
20
Years of Service
User Offline
Joined: 10th Jul 2004
Location: Vana Diel
Posted: 12th Apr 2006 23:00
try using

if= blah de blah ()=1 then set to...

I am DarkEternity (DE for short) OWNER OF ANIRE!!!
We are looking for a coder, modelers etc
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 13th Apr 2006 00:03
you do 1000 - what the actual reading is...

1000 - 0 = 1000

1000 - 1000 = 0

So that has now reversed the result.

Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 13th Apr 2006 12:27 Edited at: 14th Apr 2006 00:08
Pincho is almost correct but not quite. Since you are going from 0 to -1000 if you subtract -1000 from 1000 the result is 2000, a minus, minus is a plus.
You will need to use abs() to remove the negative value first.

So Throttle = 1000 - abs(Joystick Slider a())


vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 13th Apr 2006 12:55 Edited at: 13th Apr 2006 12:58
@The Wilderbeast ,can you tell me what throttle you are using please as I have some player code you can get which in the Code Snippets
Here
http://forum.thegamecreators.com/?m=forum_view&t=35467&b=6
And Here
http://forum.thegamecreators.com/?m=forum_view&t=39148&b=6
The Wilderbeast
19
Years of Service
User Offline
Joined: 14th Nov 2005
Location: UK
Posted: 13th Apr 2006 14:10
thnx 2 all of you, i sorted it out, all you do is:
throttle#=(joystick slider a()*-1)+1000

1000(which is 0 throttle on my joysticks)*-1=-1000
then add 1000=0

-1000(which is 100% throttle)*-1=0
0+1000=1000

thanks n e way

OMG It's the Wilderbeast
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 14th Apr 2006 00:06 Edited at: 14th Apr 2006 00:09
My method involves less calculation and will therefore be quicker.
Another option, again using less calculations is:
Throttle = 1000 + Joystick Slider a()

1000 + 0 = 1000
1000 + -1000 = 0


The Wilderbeast
19
Years of Service
User Offline
Joined: 14th Nov 2005
Location: UK
Posted: 14th Apr 2006 18:42
the only problem with that is that joystick slider a() ranges from -1000 to +1000 not 0 to 1000. but thanks anyway!

OMG It's the Wilderbeast
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 14th Apr 2006 23:26
Well my method is to get the throttle to work is simply this

if joystick slider a()=0 then move object 2,10
and to move backwards
if joystick slider a()=65535 then move object 2,-10

that works ok for Saitek X36 USB (once you sort out the caliberation on it)
and the The Thrustmaster Afterburner series of joysticks(I know I got all three of the range)

That will work for ground or flight vehicles

Hope I was of help
The Wilderbeast
19
Years of Service
User Offline
Joined: 14th Nov 2005
Location: UK
Posted: 15th Apr 2006 16:58
the only problem is that i'm using advanced flight dynamics so moveing an ojbect isn't the only thing to do, the throttle must be processed etc.

this thread can now be locked
p.s thanks 2 everybody 4 their support

OMG It's the Wilderbeast

Login to post a reply

Server time is: 2025-05-23 19:46:17
Your offset time is: 2025-05-23 19:46:17