Re: [hlcoders] Joystick Fun
Not quite. The dial controls speed in the case of flight sim.If you push it forward you go fast, if you push it back you go slower. Pretty straight forward. - Original Message - From: Reedbeta Sent: Friday, December 07, 2001 11:49 PM To: [EMAIL PROTECTED] Subject: Re: [hlcoders] Joystick Fun If I remember correctly in your original description you described this dialthingy as being capable of modifying the range of the joystick itself? IE, setthe dial at one end and you get fine control and at the other end you getcoarse control? If so, the mechanism is probably built into the joystickitself and you don't need to do a thing to have it work in HL...it will show upin the stick position values automatically.--- Nathan Taylor [EMAIL PROTECTED] wrote: Thank you, thank you. So for that dial thingy I should probably just search the msdn for the reference code I assume? Lakario - Original Message - From: botman Sent: Friday, December 07, 2001 12:11 PM To: [EMAIL PROTECTED] Subject: Re: [hlcoders] Joystick Fun Okay, i think you may have mis-understood (or maybe me). I need to code on that dial somehow and I don't know where to start since the data input style is different than a key. -Lak Look through the code. The joystick code (IN_ReadJoystick) uses joyGetPosEx (see the MSDN info for details) to read the joystick position. This will be from -32768 to 32767 for the X and Y axis. The IN_JoyMove() function translates this joystick position into pitch angles and sideways movement. Just change the IN_JoyMove() function to take the X axis values and use those for roll and take the Y axis values and use those for pitch (i.e. rip out the code that's in there and replace it with your own). There are 2 #defines near the top of the file that determine whether the joystick works using absolute positions or relative positions... #define JOY_ABSOLUTE_AXIS 0x // control like a joystick #define JOY_RELATIVE_AXIS 0x0010 // control like a mouse, spinner, trackball You might want roll to be absolute (the plane keeps rolling more and more when you hold the stick to the left or right) and use relative movement for the pitch (the plane would pitch up or down based on joystick position but wouldn't keep pitching more and more if the stick was held all the way at the top or bottom). Jeffrey "botman" Broome ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcodersGet more from the Web. FREE MSN Explorer download : http://explorer.msn.com__Do You Yahoo!?Send your FREE holiday greetings online!http://greetings.yahoo.com___To unsubscribe, edit your list preferences, or view the list archives, please visit:http://list.valvesoftware.com/mailman/listinfo/hlcodersGet more from the Web. FREE MSN Explorer download : http://explorer.msn.com
Re: [hlcoders] Joystick Fun
Oh, okay. - Original Message - From: Neale Roberts Sent: Saturday, December 08, 2001 6:17 AM To: [EMAIL PROTECTED] Subject: Re: [hlcoders] Joystick Fun It works just like an ordinary joystick axis though, except it's not sprung to return to centre. - Original Message - From: Nathan Taylor To: HLCoders Sent: Saturday, December 08, 2001 10:03 AM Subject: Re: [hlcoders] Joystick Fun Not quite. The dial controls speed in the case of flight sim.If you push it forward you go fast, if you push it back you go slower. Pretty straight forward. - Original Message - From: Reedbeta Sent: Friday, December 07, 2001 11:49 PM To: [EMAIL PROTECTED] Subject: Re: [hlcoders] Joystick Fun If I remember correctly in your original description you described this dialthingy as being capable of modifying the range of the joystick itself? IE, setthe dial at one end and you get fine control and at the other end you getcoarse control? If so, the mechanism is probably built into the joystickitself and you don't need to do a thing to have it work in HL...it will show upin the stick position values automatically.--- Nathan Taylor [EMAIL PROTECTED] wrote: Thank you, thank you. So for that dial thingy I should probably just search the msdn for the reference code I assume? Lakario - Original Message - From: botman Sent: Friday, December 07, 2001 12:11 PM To: [EMAIL PROTECTED] Subject: Re: [hlcoders] Joystick Fun Okay, i think you may have mis-understood (or maybe me). I need to code on that dial somehow and I don't know where to start since the data input style is different than a key. -Lak Look through the code. The joystick code (IN_ReadJoystick) uses joyGetPosEx (see the MSDN info for details) to read the joystick position. This will be from -32768 to 32767 for the X and Y axis. The IN_JoyMove() function translates this joystick position into pitch angles and sideways movement. Just change the IN_JoyMove() function to take the X axis values and use those for roll and take the Y axis values and use those for pitch (i.e. rip out the code that's in there and replace it with your own). There are 2 #defines near the top of the file that determine whether the joystick works using absolute positions or relative positions... #define JOY_ABSOLUTE_AXIS 0x // control like a joystick #define JOY_RELATIVE_AXIS 0x0010 // control like a mouse, spinner, trackball You might want roll to be absolute (the plane keeps rolling more and more when you hold the stick to the left or right) and use relative movement for the pitch (the plane would pitch up or down based on joystick position but wouldn't keep pitching more and more if the stick was held all the way at the top or bottom). Jeffrey "botman" Broome ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcodersGet more from the Web. FREE MSN Explorer download : http://explorer.msn.com__Do You Yahoo!?Send your FREE holiday greetings online!http://greetings.yahoo.com___To unsubscribe, edit your list preferences, or view the list archives, please visit:http://list.valvesoftware.com/mailman/listinfo/hlcoders Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
RE: [hlcoders] Joystick Fun
Yup, this is just considered the z axis. Y axis is up and down motion on stick, X is left right. Z axis is the throttle control on the side of the stick. Sometimes theres an additional twist axis called z-twist which is usually the main joystick twisting around its vertical axis. david -Original Message- From: Nathan Taylor [mailto:[EMAIL PROTECTED]] Sent: Saturday, December 08, 2001 5:21 AM To: HLCoders Subject: Re: [hlcoders] Joystick Fun Oh, okay. - Original Message - From: Neale Roberts Sent: Saturday, December 08, 2001 6:17 AM To: [EMAIL PROTECTED] Subject: Re: [hlcoders] Joystick Fun It works just like an ordinary joystick axis though, except it's not sprung to return to centre. - Original Message - From: Nathan Taylor To: HLCoders Sent: Saturday, December 08, 2001 10:03 AM Subject: Re: [hlcoders] Joystick Fun Not quite. The dial controls speed in the case of flight sim.If you push it forward you go fast, if you push it back you go slower. Pretty straight forward. - Original Message - From: Reedbeta Sent: Friday, December 07, 2001 11:49 PM To: [EMAIL PROTECTED] Subject: Re: [hlcoders] Joystick Fun If I remember correctly in your original description you described this dial thingy as being capable of modifying the range of the joystick itself? IE, set the dial at one end and you get fine control and at the other end you get coarse control? If so, the mechanism is probably built into the joystick itself and you don't need to do a thing to have it work in HL...it will show up in the stick position values automatically. --- Nathan Taylor [EMAIL PROTECTED] wrote: Thank you, thank you. So for that dial thingy I should probably just search the msdn for the reference code I assume? Lakario - Original Message - From: botman Sent: Friday, December 07, 2001 12:11 PM To: [EMAIL PROTECTED] Subject: Re: [hlcoders] Joystick Fun Okay, i think you may have mis-understood (or maybe me). I need to code on that dial somehow and I don't know where to start since the data input style is different than a key. -Lak Look through the code. The joystick code (IN_ReadJoystick) uses joyGetPosEx (see the MSDN info for details) to read the joystick position. This will be from -32768 to 32767 for the X and Y axis. The IN_JoyMove() function translates this joystick position into pitch angles and sideways movement. Just change the IN_JoyMove() function to take the X axis values and use those for roll and take the Y axis values and use those for pitch (i.e. rip out the code that's in there and replace it with your own). There are 2 #defines near the top of the file that determine whether the joystick works using absolute positions or relative positions... #define JOY_ABSOLUTE_AXIS 0x // control like a joystick #define JOY_RELATIVE_AXIS 0x0010 // control like a mouse, spinner, trackball You might want roll to be absolute (the plane keeps rolling more and more when you hold the stick to the left or right) and use relative movement for the pitch (the plane would pitch up or down based on joystick position but wouldn't keep pitching more and more if the stick was held all the way at the top or bottom). Jeffrey botman Broome ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcodersGet more from the Web. FREE MSN Explorer download : http://explorer.msn.com __ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
Re: [hlcoders] Joystick Fun
Okay, i think you may have mis-understood (or maybe me). I need to code on that dial somehow and I don't know where to start since the data input style is different than a key. -Lak Look through the code. The joystick code (IN_ReadJoystick) uses joyGetPosEx (see the MSDN info for details) to read the joystick position. This will be from -32768 to 32767 for the X and Y axis. The IN_JoyMove() function translates this joystick position into pitch angles and sideways movement. Just change the IN_JoyMove() function to take the X axis values and use those for roll and take the Y axis values and use those for pitch (i.e. rip out the code that's in there and replace it with your own). There are 2 #defines near the top of the file that determine whether the joystick works using absolute positions or relative positions... #define JOY_ABSOLUTE_AXIS 0x // control like a joystick #define JOY_RELATIVE_AXIS 0x0010 // control like a mouse, spinner, trackball You might want roll to be absolute (the plane keeps rolling more and more when you hold the stick to the left or right) and use relative movement for the pitch (the plane would pitch up or down based on joystick position but wouldn't keep pitching more and more if the stick was held all the way at the top or bottom). Jeffrey botman Broome ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Joystick Fun
Hmm maybe I am not makign sense. Look here: http://www.microsoft.com/hardware/sidewinder/_graphics/Devices/prec2/prec2-Mains-02-02.jpgsee the grey nob thing on the left of the stick? Mine is similar to that but just flat. Anyway that controls speed in Flight Sim, can I make that control speed in HL? Lakario - Original Message - From: botman Sent: Friday, December 07, 2001 6:03 PM To: [EMAIL PROTECTED] Subject: Re: [hlcoders] Joystick Fun So for that dial thingy I should probably just search the msdn for thereference code I assume? LakarioIf by "dial thingy" you mean the potentiometer inside the joystick, then no,MSDN won't tell you anything about the way the potentiometer works.electrical engineering mode=onThe joystick works by adjusting the setting of a potentiometer for each axis(one for the X and one for the Y). The potentiometer is a variable resistorthat can increase or decrease the flow of electrons in a wire (i.e. reduceor increase the resistance, respectively). There is a constant voltageapplied to one side of the potentiometer (usually +5V) and the other side isfed into an A/D (analog to digital) converter. The A/D converter takes theinput voltage from the potentiometer and converts that a binary value (let'sassume it's a 16 bit D/A converter). When the voltage is at the highervalue (+5V), the A/D converter will output the largest value (32768 if it'sa signed 16 bit value). When the potentiometer is moved to the oppositeposition, the voltage will be at it's lowest value (0V) and the A/Dconverter will output the lowest value (-32768 if it's a signed 16 bitvalue). As you adjust the potentiometer between the lowest setting and thehighest setting, the potentiometer will adjust the resistance and thuschange the voltage (since according to Ohm's law, these are inverslyproportional) and the A/D converter will output a binary value between thelowest value and the highest value in proportion to the setting of thepotentiometer.electrical engineering mode=offOf course, you don't care HOW the joystick works, all you need to know isthat you get a large binary value when the joystick is at one setting, youget a small binary value when the joystick is at the other setting, and youget values in between these when the joystick is moved from one position tothe other extreme. The MSDN documents will tell you how these values arereturned in the Windows API. You can also just look through the Half-LifeSDK code in inputw32.cpp to see what it does with these values that getreturned from joyGetPosEx().Jeffrey "botman" Broome___To unsubscribe, edit your list preferences, or view the list archives, please visit:http://list.valvesoftware.com/mailman/listinfo/hlcodersGet more from the Web. FREE MSN Explorer download : http://explorer.msn.com
RE: [hlcoders] Joystick Fun
The throttle, usually the z axis. Thats all I can add to this conversation Have fun -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Nathan Taylor Sent: 07 December 2001 23:06 To: HLCoders Subject: Re: [hlcoders] Joystick Fun Hmm maybe I am not makign sense. Look here: http://www.microsoft.com/hardware/sidewinder/_graphics/Devices/prec2/prec2-M ains-02-02.jpg see the grey nob thing on the left of the stick? Mine is similar to that but just flat. Anyway that controls speed in Flight Sim, can I make that control speed in HL? Lakario - Original Message - From: botman Sent: Friday, December 07, 2001 6:03 PM To: [EMAIL PROTECTED] Subject: Re: [hlcoders] Joystick Fun So for that dial thingy I should probably just search the msdn for the reference code I assume? Lakario If by dial thingy you mean the potentiometer inside the joystick, then no, MSDN won't tell you anything about the way the potentiometer works. electrical engineering mode=on The joystick works by adjusting the setting of a potentiometer for each axis (one for the X and one for the Y). The potentiometer is a variable resistor that can increase or decrease the flow of electrons in a wire (i.e. reduce or increase the resistance, respectively). There is a constant voltage applied to one side of the potentiometer (usually +5V) and the other side is fed into an A/D (analog to digital) converter. The A/D converter takes the input voltage from the potentiometer and converts that a binary value (let's assume it's a 16 bit D/A converter). When the voltage is at the higher value (+5V), the A/D converter will output the largest value (32768 if it's a signed 16 bit value). When the potentiometer is moved to the opposite position, the voltage will be at it's lowest value (0V) and the A/D converter will output the lowest value (-32768 if it's a signed 16 bit value). As you adjust the potentiometer between the lowest setting and the highest setting, the potentiometer will adjust the resistance and thus change the voltage (since according to Ohm's law, these are inversly proportional) and the A/D converter will output a binary value between the lowest value and the highest value in proportion to the setting of the potentiometer. electrical engineering mode=off Of course, you don't care HOW the joystick works, all you need to know is that you get a large binary value when the joystick is at one setting, you get a small binary value when the joystick is at the other setting, and you get values in between these when the joystick is moved from one position to the other extreme. The MSDN documents will tell you how these values are returned in the Windows API. You can also just look through the Half-Life SDK code in inputw32.cpp to see what it does with these values that get returned from joyGetPosEx(). Jeffrey botman Broome ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Joystick Fun
Thanks :) - Original Message - From: Simon Street Sent: Friday, December 07, 2001 7:46 PM To: [EMAIL PROTECTED] Subject: RE: [hlcoders] Joystick Fun The throttle, usually the z axis.Thats all I can add to this conversationHave fun-Original Message-From: [EMAIL PROTECTED][mailto:[EMAIL PROTECTED]]On Behalf Of Nathan TaylorSent: 07 December 2001 23:06To: HLCodersSubject: Re: [hlcoders] Joystick FunHmm maybe I am not makign sense. Look here:http://www.microsoft.com/hardware/sidewinder/_graphics/Devices/prec2/prec2-Mains-02-02.jpg see the grey nob thing on the left of the stick? Mine issimilar to that but just flat. Anyway that controls speed in Flight Sim, canI make that control speed in HL?Lakario- Original Message -From: botmanSent: Friday, December 07, 2001 6:03 PMTo: [EMAIL PROTECTED]Subject: Re: [hlcoders] Joystick Fun So for that dial thingy I should probably just search the msdn for thereference code I assume? LakarioIf by "dial thingy" you mean the potentiometer inside the joystick, then no,MSDN won't tell you anything about the way the potentiometer works.electrical engineering mode=onThe joystick works by adjusting the setting of a potentiometer for each axis(one for the X and one for the Y). The potentiometer is a variable resistorthat can increase or decrease the flow of electrons in a wire (i.e. reduceor increase the resistance, respectively). There is a constant voltageapplied to one side of the potentiometer (usually +5V) and the other side isfed into an A/D (analog to digital) converter. The A/D converter takes theinput voltage from the potentiometer and converts that a binary value (let'sassume it's a 16 bit D/A converter). When the voltage is at the highervalue (+5V), the A/D converter will output the largest value (32768 if it'sa signed 16 bit value). When the potentiometer is moved to the oppositeposition, the voltage will be at it's lowest value (0V) and the A/Dconverter will output the lowest value (-32768 if it's a signed 16 bitvalue). As you adjust the potentiometer between the lowest setting and thehighest setting, the potentiometer will adjust the resistance and thuschange the voltage (since according to Ohm's law, these are inverslyproportional) and the A/D converter will output a binary value between thelowest value and the highest value in proportion to the setting of thepotentiometer.electrical engineering mode=offOf course, you don't care HOW the joystick works, all you need to know isthat you get a large binary value when the joystick is at one setting, youget a small binary value when the joystick is at the other setting, and youget values in between these when the joystick is moved from one position tothe other extreme. The MSDN documents will tell you how these values arereturned in the Windows API. You can also just look through the Half-LifeSDK code in inputw32.cpp to see what it does with these values that getreturned from joyGetPosEx().Jeffrey "botman" Broome___To unsubscribe, edit your list preferences, or view the list archives,please visit:http://list.valvesoftware.com/mailman/listinfo/hlcodersGet more from the Web. FREE MSN Explorer download : http://explorer.msn.com___To unsubscribe, edit your list preferences, or view the list archives, please visit:http://list.valvesoftware.com/mailman/listinfo/hlcodersGet more from the Web. FREE MSN Explorer download : http://explorer.msn.com
Re: [hlcoders] Joystick Fun
If I remember correctly in your original description you described this dial thingy as being capable of modifying the range of the joystick itself? IE, set the dial at one end and you get fine control and at the other end you get coarse control? If so, the mechanism is probably built into the joystick itself and you don't need to do a thing to have it work in HL...it will show up in the stick position values automatically. --- Nathan Taylor [EMAIL PROTECTED] wrote: Thank you, thank you. So for that dial thingy I should probably just search the msdn for the reference code I assume? Lakario - Original Message - From: botman Sent: Friday, December 07, 2001 12:11 PM To: [EMAIL PROTECTED] Subject: Re: [hlcoders] Joystick Fun Okay, i think you may have mis-understood (or maybe me). I need to code on that dial somehow and I don't know where to start since the data input style is different than a key. -Lak Look through the code. The joystick code (IN_ReadJoystick) uses joyGetPosEx (see the MSDN info for details) to read the joystick position. This will be from -32768 to 32767 for the X and Y axis. The IN_JoyMove() function translates this joystick position into pitch angles and sideways movement. Just change the IN_JoyMove() function to take the X axis values and use those for roll and take the Y axis values and use those for pitch (i.e. rip out the code that's in there and replace it with your own). There are 2 #defines near the top of the file that determine whether the joystick works using absolute positions or relative positions... #define JOY_ABSOLUTE_AXIS 0x // control like a joystick #define JOY_RELATIVE_AXIS 0x0010 // control like a mouse, spinner, trackball You might want roll to be absolute (the plane keeps rolling more and more when you hold the stick to the left or right) and use relative movement for the pitch (the plane would pitch up or down based on joystick position but wouldn't keep pitching more and more if the stick was held all the way at the top or bottom). Jeffrey botman Broome ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcodersGet more from the Web. FREE MSN Explorer download : http://explorer.msn.com __ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
[hlcoders] Joystick Fun
Hey guys, I have a few questions about coding a joystick into a mod. If you have ever played Flight Simulator by MS or any other good ones you'll know that you can use the dial found on most joysticks to control your speed. Well in the mod I am researching this for you fly an airplane and I would like to be able to do the same thing with that dial in this mod as is done in a flight sim. By simple analysis I can tell the wheel on my Joystick (Microsoft Sidewinder 2)is dial with turn capacity of 180 degrees. Now my assumption is that at the wheel has a sensor inside it that examines the position of the wheel and then outputs the necessary increment of data (speed in this case). Seeing as the wheel is not setupwith button states for bindinglikeJoy4 or whatever I assume some coding will be involved, so my question is: does anyone know where I can find the code I need for the joystick? Also my joystick has the ability to turn 45 degrees on the Y axis while keeping still on the X axis, inFlight Simulator it causes the plane to do a sharp turn to a perpendicular to the ground. Is there anyway to GET that turn data and reflect it on the Half-Life model? Finally, since the game I am working on is like a flight sim we want the joystick to function like a real joystick, pull back to ascend, push forward to descend.Now the easiest way to make that happen is to invert the mouse in advanced controls however it is rather lousy playing with the mouse functioning like a joystick, so is there anyway we can program "Invert Joystick"into the code? Regards,LakarioModDev.netICQ: Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com