UDN
Search public documentation:
SettingUpWeapons
日本語訳
中国翻译
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
中国翻译
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
UE3 Home > Gameplay Elements > Setting Up Weapons
Setting Up Weapons
Modeling Weapons - Setup and Rigging
Weapon Export
Weapon Import and Setup
Setting Up Sockets
Sockets were mentioned previously as being used as attachment points for muzzle flashes as well as any additional effects the weapon may require. Sockets are essentially locators parented to a specific bone which can named and then be offset and given their own individual rotation. This provides an easy way to attach or spawn items at specific locations. Sockets are added to a skeletal mesh inside of UnrealEd through the AnimSet Editor. Press the button in the toolbar to open the Socket Manager. The button will open a new dialog that lists all the bones available in the mesh. Select the bone that was added at the tip of the barrel of the mesh and then press OK. This will bring up another dialog where the new socket can be given a name that will be used to identify it in code. Once you've entered a name, press OK to add the new socket. It should appear in the Preview Pane of the AnimSet Editor and in the socket list of the Socket Manager.Creating Projectiles
A projectile is the physical representation of the weapon fire. The visual component of Projectiles in Unreal are simply particle systems. Creating particle sytems for projectiles is a straightforward process similar to making any other particle system. Essentially, you want to set up a particle system that recreates how you want to the projectile to appear while in flight. The particle system can be made up of as many emitters as necessary to get the desired effect. Some examples of projectile particle systems are shown below:Setting Up Muzzle Flashes
Muzzle flashes are used to simulate the projectile being expelled from the barrel of the weapon, like the flash you would see when a gun is fired in real life. The weapon system in Unreal uses a particle system as the visual component of a muzzle flash. As with projectiles, the particle system for a muzzle flash can be made up of as many emitters as necessary to get the desired look. Some examples of muzzle flash particle systems are shown below:For Programmers
- The name of the 1st Person Mesh.
- The name of the Animation Set.
- The name of the Pickup Mesh.
- The names of the Pick up, Equip, Put down, and Firing Sounds.
- The names of the Projectile Particle Systems (if firing projectiles).
- The names of the Muzzle Flash Particle Systems.
- The name of the Crosshair Texture and Coordinates.
Creating The Script File
Here is how you would enter all of the needed information into a very basic UnrealScript .uc file for your weapon: MyWeapon.ucclass MyWeapon extends UTWeapon; defaultproperties { Begin Object class=AnimNodeSequence Name=MeshSequenceA bCauseActorAnimEnd=true End Object // Weapon SkeletalMesh Begin Object Name=FirstPersonMesh SkeletalMesh=SkeletalMesh'WP_LinkGun.Mesh.SK_WP_Linkgun_1P' AnimSets(0)=AnimSet'WP_LinkGun.Anims.K_WP_LinkGun_1P_Base' Animations=MeshSequenceA Scale=0.9 FOV=60.0 End Object // Pickup SkeletalMesh Begin Object Name=PickupMesh SkeletalMesh=SkeletalMesh'WP_LinkGun.Mesh.SK_WP_LinkGun_3P' End Object WeaponFireTypes(0)=EWFT_Projectile WeaponProjectiles(0)=class'UTProj_LinkPlasma' WeaponEquipSnd=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_RaiseCue' WeaponPutDownSnd=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_LowerCue' WeaponFireSnd(0)=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_FireCue' WeaponFireSnd(1)=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_AltFireCue' PickupSound=SoundCue'A_Pickups.Weapons.Cue.A_Pickup_Weapons_Link_Cue' MuzzleFlashSocket=MuzzleFlashSocket MuzzleFlashPSCTemplate=ParticleSystem'WP_LinkGun.Effects.P_FX_LinkGun_MF_Primary' CrosshairImage=Texture2D'UI_HUD.HUD.UTCrossHairs' CrossHairCoordinates=(U=384,V=0,UL=64,VL=64) }
Tuning Weapons
There are many parameters which control how a weapon functions, found within several classes including the weapon class itself as well as classes for any projectiles being used. An explanation of many of the commonly used parameters as well as how weapons function on the code side is available on the Weapons Technical Guide page.Useful Console Commands
One feature of the Unreal Engine which is very useful for tuning weapons is theeditactor
console command. While using the weapon you can type editactor class=weapon
at the console, and a property window should pop up. This allows you to tune almost all of the parameters as you use the weapon, making iteration very quick.