top of page

VR Weapon

The fundamental base for every weapon class. Easy game ready setup.

Class name:

Include:

Type:

Lines of code:

AVR_Weapon

#include "VR/VR_Player/Weapons/VR_Weapon.h"

Interactable Actor

1411

​General Information

Description

VR Weapon is a weapon class which is fundamental and from it can be any weapon type inherited. This actor is using VR Grab Component(See VR Grab Component).


VR Weapon is a weapon class which is fundamental and from it can be any weapon type inherited.
VR Weapon

Components

CImpactParicle - This is a Particle System Component which spawns particles when the bullet hits the surface.

LSmokeParticle - This is a Particle System Component which spawns smoke after each gun shoot.

LMuzzleParticle - This is a Particle System Component which spawns muzzle flash after each gun shoot.

Weapon_Mesh - This is a weapon Skeletal Mesh Component.

Mag_Box - This is a Box Component which checks for the ammo overlap.

Handle_Box - This is a Box Component which checks for hand overlaps for grabbing the handle.



Settings

Main
  • Weapon Icon Mesh - This is a Static Mesh variable which is used for displaying in VR Hand Inventory(See VR Hand Inventory)(Do not forget this, otherwise might be issues).

  • Current Caliber - This is integer variable which represents the weapon ammo caliber. Only Ammo of this caliber will fit in(See VR Ammo).

  • Particle Size - This is a float variable which represents the size of Muzzle Flash particles.

  • Fire Sound -This is a sound variable which plays on shoot.

  • Empty Sound -This is a sound variable which plays on empty shoot.

  • Projectile Class - This is a class which will be spawned on shoot(See VR Weapon Projectile).

  • VR Bullet Decal Class - This is a class which will be spawned on impact(See VR Weapon Decal).

  • Damage - This is a float variable which represents the weapon damage.

  • Has Slider - This is a bool variable which represents whether or not weapon has slider.

  • Slide Mag Curve - This is a Curve variable which affects the mag when it slides in(Do not forget this, otherwise might be issues).


Particles

  • Muzzle Particle - This particle spawns after each gun shoot by LMuzzleParticle .

  • Smoke Particle - This particle spawns after each gun shoot by LSmokeParticle .

  • Default, Dirt,Rock,Sand etc. - These particles spawn on impact by CImpactParicle.



Impact particles require the following surface types. These surface types can be added in the UnrealProject\Config\DefaultEngine.ini.

+PhysicalSurfaces=(Type=SurfaceType1,Name="Dirt")
+PhysicalSurfaces=(Type=SurfaceType2,Name="Rock")
+PhysicalSurfaces=(Type=SurfaceType3,Name="Sand")
+PhysicalSurfaces=(Type=SurfaceType4,Name="Water")
+PhysicalSurfaces=(Type=SurfaceType5,Name="Glass")
+PhysicalSurfaces=(Type=SurfaceType6,Name="Cloth")
+PhysicalSurfaces=(Type=SurfaceType7,Name="Metal")
+PhysicalSurfaces=(Type=SurfaceType8,Name="wood")
+PhysicalSurfaces=(Type=SurfaceType9,Name="Grass")
+PhysicalSurfaces=(Type=SurfaceType10,Name="Carpet")
+PhysicalSurfaces=(Type=SurfaceType11,Name="Concreate")
+PhysicalSurfaces=(Type=SurfaceType12,Name="Snow")
+PhysicalSurfaces=(Type=SurfaceType13,Name="Tile")
+PhysicalSurfaces=(Type=SurfaceType14,Name="Asphalt")
+PhysicalSurfaces=(Type=SurfaceType15,Name="Brick")
+PhysicalSurfaces=(Type=SurfaceType16,Name="Cardboard")
+PhysicalSurfaces=(Type=SurfaceType17,Name="Clay")
+PhysicalSurfaces=(Type=SurfaceType18,Name="Plastic")
+PhysicalSurfaces=(Type=SurfaceType19,Name="Electrinics")
+PhysicalSurfaces=(Type=SurfaceType20,Name="Sheetrock")
+PhysicalSurfaces=(Type=SurfaceType21,Name="Plaster")
+PhysicalSurfaces=(Type=SurfaceType22,Name="Leaver")
+PhysicalSurfaces=(Type=SurfaceType23,Name="Blood")

Animations

Weapon Mesh requires animation blueprint which is inhired from VR Weapon Animation Instance class(Required otherwise project will crash)(SeeVR Weapon Animation Instance ).


Events

VR Weapon has 4 events which can be defined or use vr grab component events.


Do After Fire - This event called after each successful shoot. Output : bool IsTraceHit, FHitResult OutTraceHit.

Do After EmptyS hoot - This event called after each empty shoot.

Do On Release Mag - This event called after each release mag.

Do On Mag In - This event called after each mag in.



Blueprint API Reference

Public Member Functions

 

Get In Hand Status
  returns bInHand

Output
  bool bInHand
 

Get Just Droped
  returns bInHand

Output
  bool bJustDroped
 

Get Weapon Mesh
  returns Weapon_Mesh

Output
  USkeletalMeshComponent* Weapon_Mesh
 

Get Mag Box
  returns Mag_Box

Output
  UBoxComponent* Mag_Box
 

Get Mag Attach To Mesh
  returns MagAttachTo_Mesh

Output
  UStaticMeshComponent* MagAttachTo_Mesh
 

Get Trigger Push Int
  returns fTriggerPushInt

Output
  float fTriggerPushInt
 

Get Hammer X
  returns fHammer_X

Output
  float fHammer_X
 

Get Just Shot
  returns bJustShoot

Output
  bool bJustShoot
 

Get Safer Pressed
  returns bSaferPressed

Output
  bool bSaferPressed
 

Get Caliber
  returns CurrentCaliber

Output
  uint8 CurrentCaliber
 

Get Static Weapon Mesh
  returns Weapon_Icon_Mesh

Output
  UStaticMesh* Weapon_Icon_Mesh
 

Get Current Mag
  returns CurrentMag

Output
   AActor* CurrentMag
 

Get Grab Animation
  returns GrabAnimation

Output
   UAnimSequence* GrabAnimation
 

Get Trigger Pressed Animation
  returns TriggerPressedAnimation

Output
   UAnimSequence* TriggerPressedAnimation
 

Get A Pressed Animation
  returns APressedAnimation

Output
   UAnimSequence* APressedAnimation
 

Get Second Grab Animation
  returns SecondHandGrabAnimation

Output
   UAnimSequence* SecondHandGrabAnimation
 

Is This HandSecond Attached

Input
   AVR_Hands* Hand

Output
   return bool 
 

Public Attributes

 
class UVR_WeaponAnimationInstance * 	WeaponAnimation
 

Protected Attributes

 

class UStaticMesh * 	Weapon_Icon_Mesh
 
 

uint8 	CurrentCaliber

 
 

bool 	bAmmoApplyed
 
 

bool 	bJustShoot
 
 

bool 	bShootAnim
 
 

bool 	bSaferPressed
 
 

bool 	bAmmoLeft
 
 

bool 	bAllowAmmoIn
 
 

float 	fParticleSize
 
 

bool 	bInHand
 
 

class USoundBase * 	FireSound
 
 

class USoundBase * 	EmptySound
 
 

class UStaticMeshComponent * 	MagAttachTo_Mesh
 
 

AActor * 	CurrentMag
 
 

TSubclassOf< class AVR_WeaponProjectile > 	ProjectileClass
 
 

TSubclassOf< class AVR_BulletDecal > 	VR_BulletDecalClass
 
 

UParticleSystem * 	MuzzleParticle
 
 

UParticleSystem * 	SmokeParticle
 
 

float 	Damage
 
 

bool 	bHasSlider
 
 

UParticleSystem * 	ImpactParticle
 
 

UParticleSystemComponent * 	LMuzzleParticle
 	Particle Components to spawn.
 
 

UParticleSystemComponent * 	LSmokeParticle
 
 

UParticleSystemComponent * 	CImpactParticle
 
 

FTransform 	PrevTransform
 
 

bool 	bLatsBulletShot
 
 

UParticleSystem * 	DefaultParticle
 	Impact particles.
 
 

UParticleSystem * 	DirtParticle
 
 

UParticleSystem * 	RockParticle
 
 

UParticleSystem * 	SandParticle
 
 

UParticleSystem * 	WaterParticle
 
 

UParticleSystem * 	GlassParticle
 
 

UParticleSystem * 	ClothParticle
 
 

UParticleSystem * 	MetalParticle
 
 

UParticleSystem * 	WoodParticle
 
 

UParticleSystem * 	GrassParticle
 
 

UParticleSystem * 	CarpetParticle
 
 

UParticleSystem * 	ConcreteParticle
 
 

UParticleSystem * 	SnowParticle
 
 

UParticleSystem * 	TileParticle
 
 

UParticleSystem * 	AsphaltParticle
 
 

UParticleSystem * 	BrickParticle
 
 

UParticleSystem * 	CardboardParticle
 
 

UParticleSystem * 	ClayParticle
 
 

UParticleSystem * 	PlasticParticle
 
 

UParticleSystem * 	ElectronicsParticle
 
 

UParticleSystem * 	SheetRockParticle
 
 

UParticleSystem * 	PlasterParticle
 
 

UParticleSystem * 	LeavesParticle
 
 

UParticleSystem * 	BloodParticle
 
 

bool 	bJustDroped
 
 

float 	fTriggerPushInt
 
 

float 	fHammer_X
 
 

class AVR_Hands * 	P_MotionControllerMain
 
 

class UPhysicsConstraintComponent * 	P_PhysicsConstraintMain
 
 

class USkeletalMeshComponent * 	P_HandMeshMain
 
 

class AVR_Hands * 	P_MotionControllerSecond
 
 

class UPhysicsConstraintComponent * 	P_PhysicsConstraintSecond
 
 

class USkeletalMeshComponent * 	P_HandMeshSecond
 


bottom of page