Howto:Adding gun effects: Difference between revisions

Jump to navigation Jump to search
m
Robot: Cosmetic changes
m (Bot: Automated text replacement (-aircrafts +aircraft))
m (Robot: Cosmetic changes)
Line 1: Line 1:
[[Image:Thud_gunnery.jpg|thumb|270px|The [[Republic F-105 Thunderchief|F-105]] in action.]]
[[File:Thud_gunnery.jpg|thumb|270px|The [[Republic F-105 Thunderchief|F-105]] in action.]]
With [[Flightgear]]'s increasing capabilities, '''bullet effects''' such as tracers and smoke on impact are now supported. You will need [[FlightGear 1.9.0|FlightGear version 1.9]] or later, in order to use the effects.
With [[Flightgear]]'s increasing capabilities, '''bullet effects''' such as tracers and smoke on impact are now supported. You will need [[FlightGear 1.9.0|FlightGear version 1.9]] or later, in order to use the effects.


== Setup ==
== Setup ==
There is no default key/button binding for a trigger in FlightGear, so you will have to make your own. An obvious choice of button would be the trigger on a [[joystick]], but you can also make a keyboard binding by adding something like this to your <tt>[[$FG_ROOT]]/keyboard.xml</tt> file:  
There is no default key/button binding for a trigger in FlightGear, so you will have to make your own. An obvious choice of button would be the trigger on a [[joystick]], but you can also make a keyboard binding by adding something like this to your <tt>[[$FG ROOT]]/keyboard.xml</tt> file:  


  <key n="101">
  <key n="101">
Line 24: Line 24:
In the code, we have used '''e''' as the trigger. You can change it to a choice of your own but '''e''' is the standard key binding used by most aircraft in FlightGear.  
In the code, we have used '''e''' as the trigger. You can change it to a choice of your own but '''e''' is the standard key binding used by most aircraft in FlightGear.  


Joystick bindings are a bit more complex. Sample code is below, but you will want to read the wiki article on [[Joystick]]s.
Joystick bindings are a bit more complex. Sample code is below, but you will want to read the wiki article on [[Joystick]]s.


See more complex/complete sample code below.
See more complex/complete sample code below.


== Adding guns and bullet effects to your Airplane ==
== Adding guns and bullet effects to your Airplane ==
Once you have a key or button binding defined to active the trigger, you'll then need to add the needed [[AI_Systems#Submodels]] configuration file to your airplane's root directory, and ensure the file is activated in your *-set.xml file. The choice of tracer, smoke and impact visual models is up to you. You may also add a sound effect to your sound configuration file that activates with the trigger.
Once you have a key or button binding defined to active the trigger, you'll then need to add the needed [[AI Systems#Submodels]] configuration file to your airplane's root directory, and ensure the file is activated in your *-set.xml file. The choice of tracer, smoke and impact visual models is up to you. You may also add a sound effect to your sound configuration file that activates with the trigger.


The standard trigger location for FlightGear is
The standard trigger location for FlightGear is
Line 50: Line 50:
     . . .
     . . .


== Aircraft already equipped with guns==
== Aircraft already equipped with guns ==
Some aircraft have the needed submodel files included.
Some aircraft have the needed submodel files included.
All aircraft equipped with guns in [http://home.comcast.net/~davidculp2/hangar/hangar.html Dave's hangar] are capable bullet effects. Like:
All aircraft equipped with guns in [http://home.comcast.net/~davidculp2/hangar/hangar.html Dave's hangar] are capable bullet effects. Like:
Line 70: Line 70:


== Current limitations ==
== Current limitations ==
* Submodel information is not sent with the [[Howto: Multiplayer|multiplayer]] protocol, so multiplayer users will not be effected by your bullets. The tracers, smoke and impact effects will only be seen by you.
* Submodel information is not sent with the [[Howto: Multiplayer|multiplayer]] protocol, so multiplayer users will not be effected by your bullets. The tracers, smoke and impact effects will only be seen by you.  
* The impact cylinder for models is fairly large, so you will see impacts occur outside of the target model's boundaries.
* The impact cylinder for models is fairly large, so you will see impacts occur outside of the target model's boundaries.


== More complex/complete sample keyboard code ==
== More complex/complete sample keyboard code ==


Different FlightGear aircraft use different locations for the main armament trigger. Two locations are commonly used:
Different FlightGear aircraft use different locations for the main armament trigger. Two locations are commonly used:


   controls/armament/trigger  (preferred)
   controls/armament/trigger  (preferred)
Line 133: Line 133:
       </key>
       </key>


==Sample joystick code ==
== Sample joystick code ==


This sample code that can be modified/inserted into a joystick XML file uses one button to trigger the main armament and another button to trigger the secondary armament:
This sample code that can be modified/inserted into a joystick XML file uses one button to trigger the main armament and another button to trigger the secondary armament:

Navigation menu